LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp port hangs open when crash of program

(Posted in Labview by mistake)
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?
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 ) 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 3
(3,199 Views)
When your client terminates without disconnecting, the server probably continues to think that it has an active connection, and so may be preventing other clients from connecting. It may be possible to reset your server when this happens and that may be one solution.
0 Kudos
Message 2 of 3
(3,173 Views)
ok - So I should make sure the server has a valid timeout time and retries set.  Can you suggest a reasonable setting for each of these?

Message Edited by wedge on 05-22-2006 09:52 AM

0 Kudos
Message 3 of 3
(3,169 Views)