<?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 can&amp;#39;t connect to working server</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112697/nrf9160-can-t-connect-to-working-server</link><description>Hello, 
 
 I&amp;#39;ve been developing code on nRF9160 for a while. In the beginning everything was straight forward and working just fine also the code was pretty simple. Now like 70% of the time when I try to connect to a server (which I know is working and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Sep 2024 06:00:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112697/nrf9160-can-t-connect-to-working-server" /><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/501071?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 06:00:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa62027f-3516-4160-8900-fa9b97aeef4b</guid><dc:creator>lobaro-theo</dc:creator><description>&lt;p&gt;We will try PION DTLS 3.0 these days which should have grown on CID support, at least what the release notes say.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/501070?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 05:52:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:034c41b9-687d-4394-a502-707cb2a917d9</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;Congratulations! Therefore we developed and specified&amp;nbsp;&lt;a href="https://www.rfc-editor.org/rfc/rfc9146.html"&gt;RFC9146&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;Just one remark from a couple of years with CID: a common &amp;quot;left pain&amp;quot; is the missing &amp;quot;graceful dtls restart&amp;quot;. Without that, a restarting server endpoint (e.g. for server updates), requires a handshake again.&lt;/p&gt;
&lt;p&gt;Still not sure, which server you are using. If it&amp;#39;s&amp;nbsp;&lt;a href="https://github.com/eclipse-californium/californium"&gt;Eclipse/Californium&lt;/a&gt; , the dtls-graceful-restart is available.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/501066?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 05:44:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:255aa242-6259-4f97-b898-6458c8008614</guid><dc:creator>kuchx</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;Yes we did manage to fix the issue! It took a while of testing but eventually we found out that IP address of IoT device was changing every 5ish minutes. Good that we had two different provider SIM&amp;#39;s and we noticed that all was good with one SIM, but nothing worked for the other - hence ones IP was static, others dynamic. To address this issue, we needed to pass the CID to the server so it saves it with every new session. Whenever a new packet is received, the server checks if the CID is the same instead of checking the IP address.&lt;br /&gt;&lt;br /&gt;This piece of code fixed the issue and we don&amp;#39;t have any of these problems since:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    int dtls_cid = NRF_SO_SEC_DTLS_CID_ENABLED;
    err = nrf_setsockopt(client_fd, NRF_SOL_SECURE, NRF_SO_SEC_DTLS_CID, &amp;amp;dtls_cid, sizeof(&amp;amp;dtls_cid));
    if(err)
    {
        LOG_ERR(&amp;quot;Failed to setup socket security tag, errno %d\n&amp;quot;, errno);
        return -errno;
    }
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/501043?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 20:56:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab5374ec-5ca2-4f4b-b932-0bf679cc8783</guid><dc:creator>lobaro-theo</dc:creator><description>&lt;p&gt;Hi, did you resolve the issue in the meantime or found a workaound? I can confirm it in our firmware. I think a nrf_modem&amp;nbsp;lib update could be a reason, since for me it seem it has been introduced somehow after&amp;nbsp;updating it to 2.6.0 or 2.6.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/492224?ContentTypeID=1</link><pubDate>Thu, 04 Jul 2024 11:34:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:717111dd-e57b-4b16-978f-a8e14bf0e581</guid><dc:creator>kuchx</dc:creator><description>&lt;p&gt;I only know that it runs on AWS IoT core.&lt;br /&gt;&lt;br /&gt;But I managed to find the issue. For some reason the RRC is not connected when the device tries to create a socket. I noticed this just this morning when also the messages did not get delivered to server. It seems like a weird bug when `connect()` and `send()` does not change the RRC mode (RRC stays in idle) although the socket opening and CoAP packet creation logic has not changed (only some logging and double checks added and that&amp;#39;s it). As a template I took &lt;a href="https://academy.nordicsemi.com/courses/cellular-iot-fundamentals/lessons/lesson-5-cellular-fundamentals/topic/lesson-5-exercise-2/"&gt;this &lt;/a&gt;project and just added the stuff I needed for logging. I reverted the code and now all runs smoothly.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Anyway thanks for your input, much appreciated! Now I need to pinpoint what exactly causes this to be able to fix it in code. If by any chance you have seen something similar and have idea which peripheral or setting might cause this, let me know!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/492072?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 12:51:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54598c5f-e738-40d7-bede-102241ff65bd</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;And do you know, which implementation is used on the server side?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/492050?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 11:41:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d8c643b-df65-40fe-a914-145a990af96d</guid><dc:creator>kuchx</dc:creator><description>&lt;p&gt;Well the problem is I don&amp;#39;t have direct access to these server logs. I asked the system administrator to check if any messages are incoming when this issue happens, but he did not see anything out of the ordinary. I&amp;#39;ll try to use the modem trace&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 can't connect to working server</title><link>https://devzone.nordicsemi.com/thread/492042?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 11:13:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc150e60-9e9c-493a-a4d3-aa15144d503f</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;&amp;gt; &lt;span&gt;I don&amp;#39;t see any logs on server side ... our server&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you don&amp;#39;t provide information about the server (e.g. which implementation and version), it will be hard to see the cause.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you don&amp;#39;t get logs on the server side but have access to the vm/pc the server is running on, a ip-capture from the server side may help to see more. Or a modem-trace may also help to see more.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For &lt;a href="https://github.com/eclipse-californium/californium/wiki/Logs-and-IP-Capturing-%E2%80%90-How-To-Provide-The-Right-Information#ip-capturing"&gt;ip-captures&lt;/a&gt; you may follow the instruction in this link to Californium&amp;#39;s Wiki.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For a modem-trace you will find the infos here in this forum.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>