LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp port hangs open when crash of program

I am using the TCP library to open, write, read, close TCP port 5002.  Everything works great except for when the program crashes (still in dev phase :P) and I don't get a chance to call "DisconnectFromTCPServer" I am not able to reconnect to that port but I can still connect to that host - I assume this is because the port is left open etc.
 
Is there any way I can force that port to close if its open?
0 Kudos
Message 1 of 5
(2,897 Views)
I am assuming that you mean the client program crashes.
 
Tell us a little more about that "server". Is this also a LabVIEW program? If so, you can reset the connection after an idle timeout or even design it so it allows multiple concurrent connections to the same port.
0 Kudos
Message 2 of 5
(2,884 Views)
Yes - this is on the client side using CVI 8.0 TCP Library. 
I am communicating directly with a compumotor 6K controller which is setup as the TCP server with dedicated ports (5001-5004).
 
Here is exactly what happens:
 
Good Run
Connect to TCP from client
read & write to server
Disconnect TCP
Able to reconnect next time
 
Bad Run
Connect to TCP from client
read & write to server
program shutdown or crash so no Disconnect took place
try to run program again - waits and waits to connect to that port - gives timeout
the only way to connect now is to shut down the server or reboot client so again I assume the port is locked?
thanks..
W
0 Kudos
Message 3 of 5
(2,883 Views)
OK, you are on the wrong board. This is LabVIEW, but you're using CVI. The Labwindows/CVI board is over there:
 
In any case, I think the problem lies entirely with the server, seems to be pretty primitive. Good luck!
0 Kudos
Message 4 of 5
(2,880 Views)
My bad - but it also happens in Labview. 
0 Kudos
Message 5 of 5
(2,876 Views)