Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting Connection Loss

Hi All,

I'm working with two computers that are each running a LV program to achieve
TCP communication. Please see attached LLB. Both PCs are connected via a
switch that is running a DHCP server.

My plan was to watch the error cluster from the TCP Read function to ensure
that the connection is still valid.

So, to test this, I run the two VIs on the two PCs and I physically
disconnect the ethernet cable from one of the PCs.

What I am seeing is that only the PC that is disconnected from the network
registers and error (error 66). The other PC only registers a timeout
error.

My question is, how can I tell from the second PC that the connection has
been lost. I know that I could use a timer, but I was hoping to avoid that.

Thanks for you
help

Denis
0 Kudos
Message 1 of 3
(3,989 Views)
Sorry, forgot the attachment...



[Attachment TCP Test.llb, see below]
0 Kudos
Message 2 of 3
(3,989 Views)
I do not think there is another way do this than using a timeout. The deal is that the recieving computer monitors a port for data. This is the only way it gets information from the remote computer. It is not like there are status lines to verify connection. You can either wait a reasonable amount of time for the data--if it is not there then timeout, assuming a broken connection. Or you can use TCP to have the previously listen only computer now sending data to the previouly sending only computer. It is indirect, but now there is a two way dependency between the computers and both can detect a broken connection.
0 Kudos
Message 3 of 3
(3,989 Views)