![]() |
Check if Port is open
Hi All,
I am trying to use this in my installer to see if a port is open. I need to show a message box if the port cannot be used or proceed if its ok to use the port. http://nsis.sourceforge.net/Check_open_ports I am not able to figure out the example in this page. If I used the condition with {If}, how would this be: ${If} ${TCPPortOpen} $PortNumber MessageBox MB_OK|MB_ICONSTOP "$PortNumber is already using by another program..." Abort ${Else} MessageBox MB_OK"$PortNumber is open to use" Is this correct? |
Looks OK to me. What happens when you run your installer?
|
The installation proceeds no matter what port I give. Is there any port on my Windows machine I can specify where this check will fail and abort?
|
There should be an ${EndIf} at the end of that code. Do you get any warnings when you compile the script?
|
Hi Jason,
Yes I do have a ${EndIf}, didnt post the whole snippet, here it is: ${If} ${TCPPortOpen} $PortNumber MessageBox MB_OK|MB_ICONSTOP "$PortNumber is already using by another program..." Abort ${Else} MessageBox MB_OK "$PortNumber is open to use" ${EndIf} what I don't get is , if the Port is open as per this line below, ${If} ${TCPPortOpen} $PortNumber Doesn't this mean that the port is OK to use and proceed with the install? |
Open probably means some application is using it. I don't understand how this can be so hard to test, since you are checking for ports I assume you have some application that opens a port so you can just run it and test your installer. You can also use netstat or download TCPView to find open ports on your machine...
|
Thanks Anders. My understanding was "TCPPortOpen" meant an "Open" port which one could use, sorry for the confusion. I did verify that the code is working by entering a port which was in use by the application.
Thank you everyone for the inputs. |
| All times are GMT. The time now is 18:01. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.