<?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 recv() not blocking</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46942/nrf9160-bsd-socket-recv-not-blocking</link><description>My simple BSD socket example does little more than send/recv a message to a server over LTE (it&amp;#39;s adapted from Rallare&amp;#39;s tcp sample). It works, however the recv() call does not block. I&amp;#39;m currently using the v0.3.0 release (and associated tags per the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 May 2019 01:47:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46942/nrf9160-bsd-socket-recv-not-blocking" /><item><title>RE: nrf9160 bsd socket recv() not blocking</title><link>https://devzone.nordicsemi.com/thread/186271?ContentTypeID=1</link><pubDate>Fri, 10 May 2019 01:47:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23fff88d-f842-425c-a4fd-dcae261df44e</guid><dc:creator>miked531</dc:creator><description>&lt;p&gt;Success! I copied your bsd_os.c, and used nrfxlib master branch and it worked!&lt;/p&gt;
&lt;p&gt;Thank you for your assistance!&lt;/p&gt;
&lt;p&gt;Also, knowing the precise versions of the projects is a really big help. I&amp;#39;ve struggled with that often when trying out new features.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 bsd socket recv() not blocking</title><link>https://devzone.nordicsemi.com/thread/186092?ContentTypeID=1</link><pubDate>Thu, 09 May 2019 08:00:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1636b94-1462-4993-8dd1-1f0d46f9c080</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Yes, you are right. Sorry for this. The bsd_os_timedwait() has changed to take in a pointer, which was done early in april when updating the bsdlib:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicPlayground/nrfxlib/commit/dfcef2f5c7f4aec0b7265b87c09ae136c5d5e7f3"&gt;https://github.com/NordicPlayground/nrfxlib/commit/dfcef2f5c7f4aec0b7265b87c09ae136c5d5e7f3&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You will need to have nrfxlib at 1st of april (or later), and for the UARTE1 tracing, you can omit those for testing (delete code related to define CONFIG_BSD_LIBRARY_TRACE_ENABLED)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tested at_client (and a &lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/ntp/src/main.c"&gt;ntp example&lt;/a&gt;, without the calls to &amp;quot;blocking_*&amp;quot; functions) with the following repos:&lt;/p&gt;
&lt;p&gt;nrf -&amp;gt; git checkout v0.3.0&lt;/p&gt;
&lt;p&gt;nrfxlib -&amp;gt; git checkout master&lt;/p&gt;
&lt;p&gt;zephyr -&amp;gt; git checkout&amp;nbsp;v1.13.99-ncs2&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And this is my modified bsd_os.c:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-a654a549d7ae4891a5b917f90496476f/bsd_5F00_os.c"&gt;devzone.nordicsemi.com/.../bsd_5F00_os.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this and see if it behaves better?&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 recv() not blocking</title><link>https://devzone.nordicsemi.com/thread/186049?ContentTypeID=1</link><pubDate>Thu, 09 May 2019 04:02:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d85161f-6e61-4b93-bbe8-4e8785ed20ef</guid><dc:creator>miked531</dc:creator><description>&lt;p&gt;I was so hopeful the patch would work, but no such luck. The patch didn&amp;#39;t apply (I don&amp;#39;t have west.yml). So I grabbed bsd_os.c directly and bsd_os_timedwait() was declared differently (and it&amp;#39;s in nrfxlib). That was easy to change but then I ran into DT_NORDIC_NRF_UARTE_1_{TX,RX,CTX,RTS}_PIN undeclared errors.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve got a work around that gets me over this hurdle (looping+sleeping) so on to the next thing for now...&lt;/p&gt;
&lt;p&gt;... which is calling bind() [which I think is ultimately calling nrf_bind()] to bind a UDP socket to a port does not work. Try it with the sequence:&lt;br /&gt;create socket(AF_INET, SOCK_DGRAM, 0)&lt;br /&gt;setup sockaddr_in appropriately (using IPv4, btw)&lt;br /&gt;call bind()&lt;br /&gt;call sendto()&lt;br /&gt;on the receiving side, the source port is not what I called with bind()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 bsd socket recv() not blocking</title><link>https://devzone.nordicsemi.com/thread/185360?ContentTypeID=1</link><pubDate>Mon, 06 May 2019 07:43:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:259bebfe-8cd6-4ac9-8d61-8f13f22a0264</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&amp;#39;s an open issue on my fork which is very similar to your question (&lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/issues/2"&gt;https://github.com/Rallare/fw-nrfconnect-nrf/issues/2&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The bsdlib requires a port file (bsd_os.c), which shall hold the timed wait for all timed socket operations, either if it is blocking or configured with a timeout.&lt;/p&gt;
&lt;p&gt;This timeout function has recently been added to the fw-nrfconnect-nrf repo, more specifically this PR:&amp;nbsp;&lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/561/files"&gt;https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/561/files&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would recommend pulling this PR manually instead of updating all your repo&amp;#39;s to the latest, especially if you have a currently working setup.&lt;/p&gt;
&lt;p&gt;You can fetch a PR as a .diff or a patch by adding .diff/.patch to the end of the URL, then apply it to your tree.&lt;/p&gt;
&lt;p&gt;Example:&amp;nbsp;&lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/561.patch"&gt;https://github.com/NordicPlayground/fw-nrfconnect-nrf/pull/561.patch&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></channel></rss>