InstallerContactSite Map

Answer

If you install a server application that uses TCP IP protocol for communication is better to know before installation starts that the port you want to use is free. Using Advanced Installer you can make this check using CheckTCPPort predefined custom action.

Custom actions Go to the Custom Actions page and add the predefined UI Custom Action "Check TCP Port".

CheckFreeTCPPort

Dialog editorGo to the Dialog Editor page.

New dialogCreate a new dialog called "CheckFreeTCPPort", added after "WelcomeDlg" in the dialogs tree.

CheckFreeTCPPort dialog

Bind the port Edit control to the AI_BIND_TCP_PORT property. The Check TCP Port custom action gets the port that will be checked from AI_BIND_TCP_PORT property.

PortEdit control

Call the Check TCP Port custom action when the "Next" button is clicked. To do that the "Next" button must publish a DoAction control event with "CheckFreeTCPPort" argument. Verify the return of the check and display a message if the port is used by an other application. Do not go to the next dialog in the chain if the port is used. To display the message create a new spawn dialog and publish a SpawnDialog control event.

CheckFreeTCPPort dialog next button events

Sample Project

NoteYou can find a small sample Advanced Installer project implementing the above functionality here.