Page 1 of 1

TCP Server detect when client disconnects

Posted: 04 Sep 2019, 09:27
by KristofPauwels
I am writing a program for a RevolutionPi with Logi.CAD 3 v2.4.0.
In my program I use my RevPi as a TCP server, which waits for a client to connect and than handles on the TCP commands.
The problem I have is that I don't know how to detect when a client disconnects, is there a way to read the TCP flag of the packets we read with the TCP_Receive function.

Re: TCP Server detect when client disconnects

Posted: 18 Sep 2019, 16:32
by Walter
Hello Kristof,

after internal clarification I will give you an answer to your question:
Because of the TCP connection timeout of 30 seconds we do not think that it is a good idea to do this check with the tcp commands.
An appropriate way to perform the check would be to implement a kind of continous "ping pong" communication within your PLC code between the server and client.

kind regards
Walter