03-24-2020 12:20 PM
Hi All,
I'm using Labview 2018.
I try to create a TCP server by using TCP listen, TCP read, TCP write & TCP close. But I will not know when opposite disconnected.
I do remember we can use TCP keepalive under VISA. But I do not remember how to link TCP connection to this Keepalive property.
How it can be done or it cannot be done at all?
Thanks.
Solved! Go to Solution.
03-24-2020 01:31 PM - edited 03-24-2020 01:34 PM
It can be done but requires you to call into Winsock with a Call Library Node. There are many discussions on here how to do this for TCP NoDelay which is very similar.
However I fail to see how that will solve your problem to discover when the remote side decides to disconnect. That is rather done by keeping monitoring the link for incoming data with a TCP Read with reasonable timeout and checking the error:
no error: you got data, request the remainder and process it all.
timeout error: no data but link is still alive.
any other error: link is dead, close it!