we are quite new to CodeSys 3.5, while we are quite experienced with CodeSys 2.
In CodeSys 2 for managing incoming TCP connections we used the 'SysLibSocket.lib' library, that seems that it been ported in CodeSys 3.5 as 'SysSocket23'.
The fact is that we noticed a strange behavior of the new Librarys w.r.t. the following call:
m_BytesReceived:= SysSockRecv( m_Socket, ADR(m_ReceiveBuffer), SIZEOF(m_ReceiveBuffer), 0);
In CodeSys 2, with 'SysLibSocket.lib', m_BytesReceived is valued to 0 when the socket is closed by the client, -1 only if the socket is active and no characters have been sent by the client.
In CodeSys 3, with 'SysSocket23' we noticed that m_BytesReceived is -1 in both cases: if the socket is active and no data have been sent, but also if the socket has been closed by the client.
How can we detect if the client has closed the socket with CodeSys 3 and 'SysSocket23'?
Log in to post a comment.