LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Monitoring TCP port status

I would like to know if a tcp port is open or not. How can i do it ?
0 Kudos
Message 1 of 4
(3,198 Views)
I think you should create a TCP listener on a port. Then when 'TCP listen' returns an address and remote port, you know it has been opened..

-Stijn
0 Kudos
Message 2 of 4
(3,198 Views)
Thanks for your answer. My problem is that i want to monitor if a port is open or not, but i do not want to open it if it is not already open.My application will write acquired data if the reader opens the port and not send it if the reader closes it.
0 Kudos
Message 3 of 4
(3,198 Views)
Hello IDS,

Thank you for contacting National Instruments.

I have created an example VI that expands on Stijn's response. The TCP listen will return IP and port information if the selected port is open. If it is not, the VI will time out and send an error. By putting the TCP Listen VI in a while loop and monitoring the error status, you can monitor the status of the TCP port.

You can adjust the timeout according to your needs.

I hope this helps,

Sean C.
Applications Engineer
National Instruments
Message 4 of 4
(3,198 Views)