<?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>NRF9160 BSD socket &amp;quot;send function&amp;quot; isn&amp;#39;t blocked.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55547/nrf9160-bsd-socket-send-function-isn-t-blocked</link><description>I use BSD socket to send and receive messages to a TCP server over LTE network. 
 When I send multiple messages by using send() (with flags = 0) function, I get an EINPROGRESS error. It seems that send() function is not blocked. 
 I&amp;#39;m currently using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Jun 2020 14:56:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55547/nrf9160-bsd-socket-send-function-isn-t-blocked" /><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/257642?ContentTypeID=1</link><pubDate>Tue, 30 Jun 2020 14:56:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52bd33b6-31f7-4334-b032-e55345c47b9f</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="jbrzozoski"]I think we just bumped into this issue but we&amp;#39;re running on NCS v1.2 and BSDLIB 0.6.2 (slightly non-standard combination).&amp;nbsp; Was this bug fixed in any particular version of NCS or BSDLIB?[/quote]
&lt;p&gt;It was tested on ncs v1.3.0, which would mean bsdlib 0.7.3 was used. it was not reproducible at our end with this version. It is suspected that the rewrite in 0.7.0 (&lt;a href="https://github.com/nrfconnect/sdk-nrfxlib/blob/master/bsdlib/doc/CHANGELOG.rst#bsdlib-070"&gt;changelog here&lt;/a&gt;) fixed this issue.&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: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/257639?ContentTypeID=1</link><pubDate>Tue, 30 Jun 2020 14:42:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2760d89-1763-4ebe-bb06-715f3dcb1f47</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;I think we just bumped into this issue but we&amp;#39;re running on NCS v1.2 and BSDLIB 0.6.2 (slightly non-standard combination).&amp;nbsp; Was this bug fixed in any particular version of NCS or BSDLIB?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/228043?ContentTypeID=1</link><pubDate>Wed, 08 Jan 2020 08:42:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9adc22a9-2183-405c-a394-359ec5a22843</guid><dc:creator>Meni</dc:creator><description>&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/227955?ContentTypeID=1</link><pubDate>Tue, 07 Jan 2020 15:25:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd39b161-cb2e-4efe-9fb5-d39517e9cef8</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Thank you for the test code.&lt;/p&gt;
&lt;p&gt;I was able to reproduce this, and it seems to only manifest itself when filling up the buffer to 4k in bsdlib, where you have to try again until that packet has been free&amp;#39;d from the buffer. Changing the MIN to any number lower than 4096 bytes, for instance 4095 bytes, then it does not return EINPROGESS.&lt;/p&gt;
&lt;p&gt;I have reported this internally as a bug.&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: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/227761?ContentTypeID=1</link><pubDate>Mon, 06 Jan 2020 17:15:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c61eb1a9-f24f-4733-a93c-aa3b695ebf47</guid><dc:creator>Meni</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;No, I have only one thread that uses the modem.&lt;/p&gt;
&lt;p&gt;Attached is a source code that describes this thread.&lt;/p&gt;
&lt;p&gt;Meni&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6507.example.c"&gt;devzone.nordicsemi.com/.../6507.example.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/227682?ContentTypeID=1</link><pubDate>Mon, 06 Jan 2020 13:24:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2e22dac-a9e8-41c9-87f3-ccc0dfd27289</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;I am very sorry for the late feedback.&lt;/p&gt;
&lt;p&gt;You mention that you send and receive. Do you have other threads running modem traffic in your firmware?&lt;/p&gt;
&lt;p&gt;Could you provide an example so I can try to recreate this at my end and debug further?&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: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/226682?ContentTypeID=1</link><pubDate>Sun, 22 Dec 2019 08:41:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3463b766-4298-4b3d-b211-3f0168370075</guid><dc:creator>Meni</dc:creator><description>&lt;p&gt;No, It does not work.&lt;br /&gt;The only way it works is when I add a delay after send command.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Meni&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/226625?ContentTypeID=1</link><pubDate>Fri, 20 Dec 2019 15:47:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53c936b6-a936-4a45-9613-bcebd1f81e7d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Could this be due to a former socket operation that is on-going?&lt;/p&gt;
&lt;p&gt;What happens if you treat EINPROGRESS as a EAGAIN, ie: you try to send the same data again?&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: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/226345?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 11:10:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:154aaace-90ce-4980-a0f8-47a688a7ccbf</guid><dc:creator>Meni</dc:creator><description>&lt;p&gt;errono 119, and&amp;nbsp;&lt;span&gt;It always happens (even with newlibc).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Meni&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="left:187px;position:absolute;top:-20px;" id="gtx-trans"&gt;
&lt;div class="gtx-trans-icon"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/226297?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 08:44:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2ccd464-4f61-4858-9922-10042b70ea12</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;A UDP packet has a length field of 16 bits, so the theoretical max length is just shy of 64k. However, you are limited here by the maximum size of the bsdlib, which is 4k, as defined in bsd_limits.h::BSD_IP_MAX_MESSAGE_SIZE, so you&amp;#39;ll have to split it into chunks.&lt;/p&gt;
&lt;p&gt;And on the IP layer It&amp;#39;ll again be split into chunks (MTU size is normally 1280 bytes), but reassembled on the other end again.&lt;/p&gt;
&lt;p&gt;What is the raw errno-number that is returned?&lt;/p&gt;
&lt;p&gt;Is this behavior consistent, ie; it always happens?&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: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/226214?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 16:19:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd550997-7e22-43b3-979f-eab48cb05243</guid><dc:creator>Meni</dc:creator><description>&lt;p&gt;I am using default library (minimal libc) and setsockopt is not used.&lt;/p&gt;
&lt;p&gt;My purpose is to send 50KB buffer to remote tcp server, currently without TLS, so the buffer is full.&lt;br /&gt;As I understand, there is no other process in background.&lt;br /&gt;(Can I send 50KB buffer with single tcp packet?)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Meni&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/225608?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 11:49:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0af2f04b-b01c-411a-bce4-1ac20bd16c3c</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 the socket is configured as non-blocking with setsockopt(), you can get EINPROGRESS back. This can also occur if another sequence is on-going, like getaddrinfo(), or when the memory is full for prior bsdlib versions (but, then you should get another return code), or the buffer size is too high. Are you using zephyr minimal libc, or newlibc? The errno.h is different on those. Could you post the raw errno that you are getting?&lt;/p&gt;
&lt;p&gt;Is this TLS based communication? If yes, then the buffer size should be reduced to max. 2k&lt;/p&gt;
&lt;p&gt;&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: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/225495?ContentTypeID=1</link><pubDate>Sat, 14 Dec 2019 20:50:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:338cf3e1-5a44-46c9-8f2d-9634d47c0818</guid><dc:creator>Meni</dc:creator><description>&lt;p&gt;ERROR_STATUS blocking_send(int sock, u8_t *buf, u32_t datalen, u32_t flags, uint32_t timeout)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;u32_t offset = 0U;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;int ret;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;s64_t time_stamp = k_uptime_get();&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;s64_t milliseconds_spent = 0;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;while ((offset &amp;lt; datalen)&amp;amp;&amp;amp;(milliseconds_spent &amp;lt;timeout))&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret = send(sock, buf + offset,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MIN(4096, (datalen - offset)), flags);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (ret &amp;lt; 0)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return -errno;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; offset += ret;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;milliseconds_spent += k_uptime_delta(&amp;amp;time_stamp);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(milliseconds_spent &amp;gt;= timeout)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return STATUS_TIMEOUT;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return 0;&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 BSD socket "send function" isn't blocked.</title><link>https://devzone.nordicsemi.com/thread/225403?ContentTypeID=1</link><pubDate>Fri, 13 Dec 2019 14:25:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa45dab8-1718-4517-be66-a256c66b955c</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;There are certain use-cases where send() isn&amp;#39;t blocking, which are mentioned in the&amp;nbsp;changelog:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/bsdlib/doc/CHANGELOG.html"&gt;http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/bsdlib/doc/CHANGELOG.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you share the routine that you&amp;#39;re running?&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>