LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Pallete & KeepAlive

Solved!
Go to solution

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.

0 Kudos
Message 1 of 2
(2,465 Views)
Solution
Accepted by topic author Ansonngoo84

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!

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,434 Views)