11-01-2022 03:45 AM
Hello,
I have a TcpIp server application to comunicate with AGV client, it use Hex data to send/receive data.
I have found a question that if I send/receive data using hex data(not ascii data),when client interrupt the connection from server, the server connect states do not update ,it still display connected ,and client cannot connect after that.
I use a TcpIpDebugTool to test ,the question is the same situation.But if I use ascii data to send/recieve ,it will not happen.
Solved! Go to Solution.
11-03-2022 09:01 AM
How does the client close the socket?
Is the socket closed correctly or does the client application simply exit without closing the socket first ?
I have already observed the behaviour described, but the cause was always, that the client did not close the socket correctly.
Explanation:
This is not a problem of the PLC function block - this is a problem of the operating system,
which binds the socket and does not automatically release it again,
if the connection was not terminated correctly.
If the client can tolerate that something is sent from the server to the client without being asked,
then this can be used to determine whether the socket is still alive.
If the client is no longer connected, then the sending leads to an error,
whereupon the server socket can be closed and reopened again.
But that would only be a workaround - it would be nicer / better, if the client closes the connection correctly.