<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to SysSocket23 and SysSockRecv</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c089073e84/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c089073e84/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/c089073e84/</id><updated>2020-02-27T13:57:35.307000Z</updated><subtitle>Recent posts to SysSocket23 and SysSockRecv</subtitle><entry><title>SysSocket23 and SysSockRecv</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/c089073e84/?limit=25#f5e3" rel="alternate"/><published>2020-02-27T13:57:35.307000Z</published><updated>2020-02-27T13:57:35.307000Z</updated><author><name>diego.bernini</name><uri>https://forge.codesys.com/u/diego-bernini/</uri></author><id>https://forge.codesys.com47d76f5868a421b945e1f0af5b1f2dca07850d39</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
we are quite new to CodeSys 3.5, while we are quite experienced with CodeSys 2.&lt;/p&gt;
&lt;p&gt;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'.&lt;/p&gt;
&lt;p&gt;The fact is that we noticed a strange behavior of the new Librarys w.r.t. the following call:&lt;/p&gt;
&lt;p&gt;m_BytesReceived:= SysSockRecv( m_Socket, ADR(m_ReceiveBuffer), SIZEOF(m_ReceiveBuffer), 0);&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;How can we detect if the client has closed the socket with CodeSys 3 and 'SysSocket23'?&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;br/&gt;
Diego&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>