<?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>nRFCloud CoAP connection timeout</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/127093/nrfcloud-coap-connection-timeout</link><description>Hello DevZone, 
 I am currently trying to fix an issue I have on deployed devices, using nRF9160 with nRFCloud. Code is based on SDK 2.8.0. 
 
 In most cases, my code works fine and there is no issue. However, I sometimes have the following issue. 
 When</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Feb 2026 13:10:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/127093/nrfcloud-coap-connection-timeout" /><item><title>RE: nRFCloud CoAP connection timeout</title><link>https://devzone.nordicsemi.com/thread/562039?ContentTypeID=1</link><pubDate>Wed, 25 Feb 2026 13:10:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aac597f-393b-477a-952c-d2892c20710f</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi again Vincent!&lt;br /&gt;&lt;br /&gt;You are welcome.&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t know of any straight forward way to determine the maximum timeout duration of nrf_cloud_coap_connect(), but It should be tied to the configs I mentioned in my previous message. If you are able to test the device in an environment where the&amp;nbsp;&lt;span&gt;nrf_cloud_coap_connect()-function hangs, it should be possible to experiment a bit and see what determines the timeout.&lt;br /&gt;&lt;br /&gt;I will see if I can manage to run some tests here as well.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFCloud CoAP connection timeout</title><link>https://devzone.nordicsemi.com/thread/561970?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2026 16:15:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f6de534-8951-43a1-a981-4da5ee583f37</guid><dc:creator>Vincent44</dc:creator><description>&lt;p&gt;Thanks for the quick and detailled response.&lt;/p&gt;
&lt;p&gt;These are more or less the options I also had in mind.&lt;/p&gt;
&lt;p&gt;Is there a way to determine the maximum timeout duration of&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;nrf_cloud_coap_connect() ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;So far, I implemented a timer that periodically feeds the watchdog during the connection process. But nothing prevent that to hang forever ...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFCloud CoAP connection timeout</title><link>https://devzone.nordicsemi.com/thread/561721?ContentTypeID=1</link><pubDate>Fri, 20 Feb 2026 14:22:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:901b6aed-6a50-45e3-af2f-5f3ef57443dd</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi Vincent!&lt;br /&gt;&lt;br /&gt;Thanks for reaching out.&lt;/p&gt;
&lt;p&gt;First of all: I think you should try to refactor your code so that that the Watchdog isn&amp;#39;t starved when the device cannot connect. As you have observed connection issues isn&amp;#39;t necessarily caused by problems that requires a reboot, so when such problems occurs it&amp;#39;s better to handle them through other timeout mechanisms. Which leads me to answering your actual question: from what I know the&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&amp;nbsp;nrf_cloud_coap_connect()&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;function cannot be aborted through the API, but it s&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;hould eventually timeout if a connection cannot be established. This can take quite some time because of the retry mechanisms as you say, but these should be possible to configure. You can read about some of the different options &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/networking/nrf_cloud_coap.html"&gt;here&lt;/a&gt;. Initially&amp;nbsp;&lt;/span&gt;&lt;/span&gt;you could for example try to lower&amp;nbsp;&lt;span&gt;CONFIG_COAP_MAX_RETRANSMIT? Its default value is 4.&lt;br /&gt;&lt;br /&gt;Alternatively you could try to run&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;nrf_cloud_coap_connect&lt;/span&gt; in it&amp;#39;s own thread and abort this after a timeout configured by you. This will probably require some cleanup afterwards by closing sockets and such.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Finally, to avoid trying to connect if the coverage is bad it&amp;#39;s considered good practice to use the &lt;a href="https://docs.nordicsemi.com/bundle/ref_at_commands/page/REF/at_commands/mob_termination_ctrl_status/coneval.html"&gt;%CONEVAL&lt;/a&gt;&amp;nbsp;AT-command to get an evaluation of the LTE-connection that can be used to decide whether it&amp;#39;s worth attempting a transmission or not. You could use this before calling&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;nrf_cloud_coap_connect&lt;/span&gt;.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I hope some of this helps!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>