<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>TCP/UDP receive error in serial_lte_modem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58284/tcp-udp-receive-error-in-serial_lte_modem</link><description>Hi, 
 In our application, we need the TCP/UDP socket keeps alive even when its receiving is timeout. so we changed the process code in do_tcp_receive() and do_udp_recvfrom() to below: 
 
 After receive timeout(Log output: recv() error: -60), we found</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Apr 2020 09:29:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58284/tcp-udp-receive-error-in-serial_lte_modem" /><item><title>RE: TCP/UDP receive error in serial_lte_modem</title><link>https://devzone.nordicsemi.com/thread/243128?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 09:29:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecd29acc-b9a5-418b-a7cb-2715e3dca05d</guid><dc:creator>Siyou</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for&amp;nbsp;your update, that fix works.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TCP/UDP receive error in serial_lte_modem</title><link>https://devzone.nordicsemi.com/thread/237324?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2020 07:45:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3df3b5b2-25b7-4866-845c-549b1175750c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Proposed fixes are in this pull-request:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/1971"&gt;https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/1971&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TCP/UDP receive error in serial_lte_modem</title><link>https://devzone.nordicsemi.com/thread/236482?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 10:30:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57459df4-4d7b-49ea-a2cf-95fad561d21e</guid><dc:creator>Siyou</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;&amp;nbsp;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for you info, understand and wait for your update.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TCP/UDP receive error in serial_lte_modem</title><link>https://devzone.nordicsemi.com/thread/236473?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 10:02:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc08acc8-55cd-4a8d-b4c2-9be34c8038fa</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Siyou"]1, For TCP case, we understood the design when the recv() returned 0, but we could not understand it when recv() was timeout(return was -60), we think the socket should keep as open after client recv() from the server which did not send out any data;[/quote][quote user="Siyou"]2, For UDP case, due to it is not connection based, client is no need to re-establish connection when recvfrom() was timeout, so we think the socket should be kept as open. But we found the UDP recvfrom()/sendto()&amp;nbsp;were&amp;nbsp;not available after the recvfrom() timeout(return also was -60).[/quote]
&lt;p&gt;Thank you for clarifying both scenarios, and my apologies for misunderstanding.&lt;/p&gt;
&lt;p&gt;This looks like a bug from our side. A timeout doesn&amp;#39;t necessarily mean that the connection is gone, it should rather return with the error without closing the socket. The same needs to be handled for errno EAGAIN. I&amp;#39;ll report this back to the developers.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TCP/UDP receive error in serial_lte_modem</title><link>https://devzone.nordicsemi.com/thread/236401?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 02:37:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bb93d83-1442-49c8-83e0-ee4b31e60af7</guid><dc:creator>Siyou</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;Let me separate it to below two questions:&lt;br /&gt;1, For TCP case, we understood the design when the recv() returned 0, but we could not understand it when recv() was timeout(return was -60), we think the socket should keep as open after client recv() from the server which did not send out any data;&lt;br /&gt;2, For UDP case, due to it is not connection based, client is no need to re-establish connection when recvfrom() was timeout, so we think the socket should be kept as open. But we found the UDP recvfrom()/sendto()&amp;nbsp;were&amp;nbsp;not available after the recvfrom() timeout(return also was -60).&lt;/p&gt;
&lt;p&gt;PS: the timeout was produced by below steps:&lt;br /&gt;1), Create TCP or UDP socket and bind to TCP or UDP server;&lt;br /&gt;2), invoke recv() or recvfrom() with timeout;&lt;br /&gt;3), before and within the timeout, the TCP or UDP server does not send out any data to client.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TCP/UDP receive error in serial_lte_modem</title><link>https://devzone.nordicsemi.com/thread/236256?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 12:43:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cbd86b2-f02d-4ad9-a948-a4d12f381930</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are receiving 0 bytes, it means that the remote side is trying to gracefully shut down the connection, as also discussed here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/38021659/can-a-c-socket-recv-0-bytes-without-the-client-shutting-the-connection"&gt;https://stackoverflow.com/questions/38021659/can-a-c-socket-recv-0-bytes-without-the-client-shutting-the-connection&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is there a specific reason why you want to keep the socket alive after this point? The connection would be lost at this point and you would need to re-establish a new connection.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>