Problem with CheckTcpPort Custom Action - Advanced Installer Community
Larry Leonard
Posts: 5
Joined: Thu May 29, 2014 4:32 pm

Problem with CheckTcpPort Custom Action

Howdy,
I am a newcomer to AI (v11.2 Enterprise) and have need for my installer to check two or three ports pre install; if the port(s) is in use pop a dialogue alerting the user and failing the install.

AI has a handy CheckTcpPort custom action, but I am running into a problem where it reports the port free when it does not appear to be.

I am running the AI sample project from here and testing port 80. Port 80 is bound to a local Apache instance and Windows netstat -a shows the port as LISTENING.

Code: Select all

netstat -a

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:80             LEONARDL-DT:0          LISTENING
Below is a snippet from a verbose install log from the sample project:

Code: Select all

Action 12:21:56: CheckTcpPort. Dialog created
MSI (c) (7C:6C) [12:22:01:158]: PROPERTY CHANGE: Adding AI_BIND_TCP_PORT property. Its value is '80'.
MSI (c) (7C:6C) [12:22:01:252]: Doing action: CheckFreeTCPPort
Action 12:22:01: CheckFreeTCPPort. 
Action start 12:22:01: CheckFreeTCPPort.
MSI (c) (7C:F4) [12:22:01:267]: Invoking remote custom action. DLL: C:\Users\leonardl\AppData\Local\Temp\MSI6906.tmp, Entrypoint: CheckFreeTCPPort
MSI (c) (7C!94) [12:22:01:267]: PROPERTY CHANGE: Adding AI_PORT_TEST_RES property. Its value is 'FreePort'.
Action ended 12:22:01: CheckFreeTCPPort. Return value 1.
Any tips?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem with CheckTcpPort Custom Action

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

This is because you have used our "Get a free TCP port" predefined custom action instead of the "Check TCP port" custom action. In order to achieve what you want you should use an approach similar with the one exposed in our "Check a TCP port" article.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Larry Leonard
Posts: 5
Joined: Thu May 29, 2014 4:32 pm

Re: Problem with CheckTcpPort Custom Action

When I load the aip on the page I linked to the custom action is named "CheckFreeTCPPort".

If I go to Add Custom Action to add "Check TCP port" it adds another custom action with the same name prefix.

Adding "Get a free TCP port" gives a custom action named "GetFreeTCPPort".

What is the aip I linked to supposed to do? The text in the installer says it is checking to see if TCP port is free.
Installer screenshot
Installer screenshot
Screenshot_053014_091200_AM.jpg (55.76 KiB) Viewed 3490 times
Why would the installer log "MSI (c) (7C:6C) [12:22:01:252]: Doing action: CheckFreeTCPPort" if it is calling a different custom action?

The events for the sample aip also check for "FreePort", "UsedPort" and "SockError" - just like the CheckTCPPort page you linked to...
Events
Events
Screenshot_053014_091617_AM.jpg (80.58 KiB) Viewed 3490 times
Larry Leonard
Posts: 5
Joined: Thu May 29, 2014 4:32 pm

Re: Problem with CheckTcpPort Custom Action

LOL, I just built the installer using the aip using an older version (10.5.2) on a different machine and tested ports other than 80 and it worked correctly. I moved the 10.5.2 built installer to my test box with httpd running on port 80 and it still did not detect the port as in use, but other listening ports worked correctly.

I was able to hit the "It works" page on my localhost on port 80, so I know that it is listening, but it must not be returning the correct answer to the action. I'll try it again on machines that I know are actually serving pages just in case, but I guess that the action is working as intended.

I'm still not sure that your initial answer was correct though. ;)

Code: Select all

Action 10:15:19: CheckTcpPort. Dialog created
MSI (c) (60:38) [10:15:23:036]: PROPERTY CHANGE: Adding AI_BIND_TCP_PORT property. Its value is '135'.
MSI (c) (60:38) [10:15:23:161]: Doing action: CheckFreeTCPPort
Action 10:15:23: CheckFreeTCPPort. 
Action start 10:15:23: CheckFreeTCPPort.
MSI (c) (60:2C) [10:15:23:161]: Invoking remote custom action. DLL: C:\Users\leonardl\AppData\Local\Temp\MSID317.tmp, Entrypoint: CheckFreeTCPPort
MSI (c) (60!D4) [10:15:23:161]: PROPERTY CHANGE: Adding AI_PORT_TEST_RES property. Its value is 'UsedPort'.
Action ended 10:15:23: CheckFreeTCPPort. Return value 1.

Code: Select all

MSI (c) (60:38) [10:15:28:481]: PROPERTY CHANGE: Modifying AI_BIND_TCP_PORT property. Its current value is '135'. Its new value: '80'.
MSI (c) (60:38) [10:15:28:605]: Doing action: CheckFreeTCPPort
Action 10:15:28: CheckFreeTCPPort. 
Action start 10:15:28: CheckFreeTCPPort.
MSI (c) (60:18) [10:15:28:605]: Invoking remote custom action. DLL: C:\Users\leonardl\AppData\Local\Temp\MSIE85C.tmp, Entrypoint: CheckFreeTCPPort
MSI (c) (60!80) [10:15:28:605]: PROPERTY CHANGE: Modifying AI_PORT_TEST_RES property. Its current value is 'UsedPort'. Its new value: 'FreePort'.
Action ended 10:15:28: CheckFreeTCPPort. Return value 1.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem with CheckTcpPort Custom Action

Hello Larry,

Please keep in mind that the "Get a free TCP port" predefined custom action return a free TCP port and doesn't check the availability of a specified port. Is just start searching from the TCP port you have set in the "TCP port" field and returns in the "AI_SEARCH_TCP_PORT" the first found free port number.

The "Check TCP port" custom action check if a specified port (in the "TCP port" field) is free or not and set the result in the "AI_PORT_TEST_RES" property accordingly. Please take a look on our "Check a TCP port" article.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”