<?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>Serial lte modem mqtt connect timeout problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126478/serial-lte-modem-mqtt-connect-timeout-problem</link><description>Hi Nordic， 
 I am using the nrf52840 as the host and the nRF9160 as the modem with the serial_lte_modem library. 
 Normally, when the nrf52840 sends an MQTT connection request ( AT #XMQTTCON=1 ), if incorrect broker parameters are configured, modem_cmd_send</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Jan 2026 12:39:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126478/serial-lte-modem-mqtt-connect-timeout-problem" /><item><title>RE: Serial lte modem mqtt connect timeout problem</title><link>https://devzone.nordicsemi.com/thread/558798?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 12:39:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:222e4caa-e780-4815-b7a2-fa23887360e1</guid><dc:creator>Simon D-M</dc:creator><description>&lt;p&gt;Hi Niuniu,&lt;/p&gt;
&lt;p&gt;in NCS, our MQTT implementation is working with &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.9.2/page/zephyr/connectivity/networking/api/sockets.html"&gt;BSD socket&lt;/a&gt; under the hood.&lt;/p&gt;
&lt;p&gt;So the timeout delay should be able to be modified with the &amp;quot;&lt;code&gt;CONFIG_NET_SOCKETS_CONNECT_TIMEOUT&amp;quot;&lt;/code&gt; Kconfig (&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_NET_SOCKETS_CONNECT_TIMEOUT"&gt;link&lt;/a&gt;). By default, this value is at&amp;nbsp;3000ms, and has a range from 0ms up to 60000ms.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon D-M&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial lte modem mqtt connect timeout problem</title><link>https://devzone.nordicsemi.com/thread/558756?ContentTypeID=1</link><pubDate>Thu, 15 Jan 2026 08:27:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64ba1578-b56f-42f9-a610-685e3110e604</guid><dc:creator>brave_niuniu</dc:creator><description>&lt;p&gt;Hi simonm&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &lt;span&gt;I&amp;#39;m sorry for my late reply.&amp;nbsp;&lt;/span&gt;&lt;span&gt;The version of SLM is built based on ncs2.9.2.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;I connected to the correct broker IP and port, but added an incorrect SSL certificate, and mqtt_connect() waited for a while before returning the result. I just want to know if Zephyr has a connection timeout handling for the interior of mqtt_connect, and if so, what the timeout period is.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Niuniu&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial lte modem mqtt connect timeout problem</title><link>https://devzone.nordicsemi.com/thread/558602?ContentTypeID=1</link><pubDate>Tue, 13 Jan 2026 14:22:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6cbe229-de2e-4352-957b-e64cd69a683a</guid><dc:creator>Simon D-M</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry, I misunderstood your problem.&lt;/p&gt;
&lt;p&gt;I wasn&amp;#39;t able to reproduce your delay, what version of the SDK / SLM are you using ? I believe some changes to MQTT were made in the latest versions.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon D-M&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial lte modem mqtt connect timeout problem</title><link>https://devzone.nordicsemi.com/thread/558556?ContentTypeID=1</link><pubDate>Tue, 13 Jan 2026 06:39:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ea67a3e-de7c-4dd8-a60e-573d54dbaae9</guid><dc:creator>brave_niuniu</dc:creator><description>&lt;p&gt;Hi simon,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span&gt;I monitored the logs of nrf9160, and it really has nothing to do with semaphores; it&amp;#39;s an error returned by &lt;span style="text-decoration:underline;"&gt;mqtt_connect()&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1768285661544v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span&gt;I want to know the timeout period returned by &lt;span style="text-decoration:underline;"&gt;mqtt_connect()&lt;/span&gt; when the MQTT broker parameters are configured incorrectly, because I need to set a time limit in my application.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Niuniu&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial lte modem mqtt connect timeout problem</title><link>https://devzone.nordicsemi.com/thread/558498?ContentTypeID=1</link><pubDate>Mon, 12 Jan 2026 12:07:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fae874ce-16ef-433f-81c7-0a5dedc0dda4</guid><dc:creator>Simon D-M</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is strange, because &lt;code&gt;modem_cmd_send()&lt;/code&gt; uses default Zephyr semaphores, which should be working fine. So it doesn&amp;#39;t make sense that it returns after 170 seconds.&lt;/p&gt;
&lt;p&gt;What I believe is most likely to be happening, is that maybe after 170 seconds there is something sent to the UART. Can you maybe monitor the UART between the 2 chips to see if there is something happening on it while the function is waiting for an answer?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Simon D-M&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>