<?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>Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123531/websocket-connection-has-timeout-too-frequently</link><description>I am evaluating the nRF7002&amp;#39;s WiFi capabilities and starting off with the nRF52840DK + nRF7002EK and a project that connects to a socket and sends data. I&amp;#39;ve primarily used the Websocket Client example ( NCS v2.9.1 , zephyr/samples/net/sockets/websocket_client</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Sep 2025 13:07:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123531/websocket-connection-has-timeout-too-frequently" /><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/548067?ContentTypeID=1</link><pubDate>Mon, 08 Sep 2025 13:07:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:017f2daf-fa69-41fc-ab85-81b3ac5590ac</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;You&amp;#39;re looking at the overall timing process, from boot until socket connected, correct?&lt;/p&gt;
[quote user=""]While it was developed through Linux drivers and such rather than with NCS/VS-Code/etc., we determined it can connect to WiFi, connect to socket, and send a little data all comfortably in &amp;lt;10sec. So I&amp;#39;m expecting similar performance.[/quote]
&lt;p&gt;A linux device has more processing power for the WPA supplicant part than a nRF5-device has, and there will be a difference between the linux net based application implementation, as compared to the zephyr net implementation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The crypto cpu processing part will take around&amp;nbsp;3-4 seconds for WPA2 as an example. You can see the difference by setting up test AP&amp;#39;s with WPA2 / WPA3 and &amp;quot;open&amp;quot; security.&lt;/p&gt;
&lt;p&gt;The below tests are from a complete cold boot (ie. power off, wait, power on), which is also why the logs are missing the first boot sequence logs (ie. &amp;quot;booting&amp;nbsp;nRF connect SDK&amp;quot;&amp;nbsp;etc)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;WPA2 (nRF52840DK + nRF7002EK):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:01.631,896] &amp;lt;inf&amp;gt; sta: Static IP address (overridable): 192.168.1.99/255.255.255.0 -&amp;gt; 192.168.1.1
[00:00:03.296,081] &amp;lt;inf&amp;gt; wifi_mgmt_ext: Connection requested
[00:00:03.296,142] &amp;lt;inf&amp;gt; sta: Connection requested
[00:00:08.471,496] &amp;lt;inf&amp;gt; sta: Connected
[00:00:08.697,570] &amp;lt;inf&amp;gt; sta: Waiting for DHCP to be bound
[00:00:13.485,076] &amp;lt;inf&amp;gt; net_dhcpv4: Received: 192.168.32.163
[00:00:13.485,290] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.32.163
[00:00:13.485,321] &amp;lt;inf&amp;gt; net_config: Lease time: 36000 seconds
[00:00:13.485,351] &amp;lt;inf&amp;gt; net_config: Subnet: 255.255.255.0
[00:00:13.485,412] &amp;lt;inf&amp;gt; net_config: Router: 192.168.32.1
[00:00:13.485,809] &amp;lt;inf&amp;gt; sta: Try to open as client
[00:00:14.093,872] &amp;lt;inf&amp;gt; sta: Connected
[00:00:14.108,062] &amp;lt;inf&amp;gt; wifi_supplicant: Network interface 1 (0x20001140) down
[00:00:14.108,306] &amp;lt;inf&amp;gt; sta: Interface down&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Open security:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:01.630,187] &amp;lt;inf&amp;gt; sta: Static IP address (overridable): 192.168.1.99/255.255.255.0 -&amp;gt; 192.168.1.1
[00:00:01.642,333] &amp;lt;inf&amp;gt; wifi_mgmt_ext: Connection requested
[00:00:01.642,364] &amp;lt;inf&amp;gt; sta: Connection requested
[00:00:06.731,109] &amp;lt;inf&amp;gt; sta: Connected
[00:00:06.743,713] &amp;lt;inf&amp;gt; sta: Waiting for DHCP to be bound
[00:00:06.748,962] &amp;lt;inf&amp;gt; net_dhcpv4: Received: 192.168.32.163
[00:00:06.749,145] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.32.163
[00:00:06.749,176] &amp;lt;inf&amp;gt; net_config: Lease time: 36000 seconds
[00:00:06.749,206] &amp;lt;inf&amp;gt; net_config: Subnet: 255.255.255.0
[00:00:06.749,267] &amp;lt;inf&amp;gt; net_config: Router: 192.168.32.1
[00:00:06.749,694] &amp;lt;inf&amp;gt; sta: Try to open as client
[00:00:07.369,934] &amp;lt;inf&amp;gt; sta: Connected
[00:00:07.383,911] &amp;lt;inf&amp;gt; wifi_supplicant: Network interface 1 (0x20001140) down
[00:00:07.384,155] &amp;lt;inf&amp;gt; sta: Interface down
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looking into the implementation, there will be a timing variation on both these testing vectors, as dhcp is udp based and the zephyr dhcp client has randomness on sending the request on the first boot.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is a random delay between 1 to 10 seconds in the initial dhcp client sequence, required as per RFC2131 4.4.1, which you can set with CONFIG_NET_DHCPV4_INITIAL_DELAY_MAX=2 (value of &amp;#39;2&amp;#39; is min at this time).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here are the configurations that I added:&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NRF_WIFI_PS_EXIT_EVERY_TIM=y
CONFIG_NET_SHELL=n
CONFIG_SHELL=n
CONFIG_NET_DHCPV4_INITIAL_DELAY_MAX=2&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PS: If you want to test with no delay on initial dhcp request, you can set the &amp;quot;true -&amp;gt; false&amp;quot; in this function call:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.7.99-ncs3/subsys/net/lib/dhcpv4/dhcpv4.c#L1816"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.7.99-ncs3/subsys/net/lib/dhcpv4/dhcpv4.c#L1816&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;RFC2131 ch 4.4.1 (&lt;a href="https://www.rfc-editor.org/rfc/rfc2131.html#section-4.4"&gt;https://www.rfc-editor.org/rfc/rfc2131.html#section-4.4&lt;/a&gt;) uses the wording &amp;quot;should&amp;quot; indicating that this initial delay is optional, which I will take up internally with our networking team.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/547971?ContentTypeID=1</link><pubDate>Fri, 05 Sep 2025 18:17:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:949dbb52-7c42-4f11-9c15-45f69d98326e</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;I tested your code, along with the websocketd server, and was able to reproduce a similar log. However, the original problem is still there &amp;ndash; the overall time to perform this operation is taking too long. It&amp;rsquo;s just that we have narrowed down the source of the delay to be when the nRF is waiting for DHCP (which your latest log also shows as well).&lt;/p&gt;
&lt;p&gt;Why is this happening? As mentioned before, and as your sales rep is aware, we had previous projects using the nRF7002. We tested these with the same router and same Linux host as this current project, yet they did not experience this issue. These previous projects had the nRF code developed through Linux drivers, not through NCS/Zephyr. So perhaps this is something to do with the Zephyr drivers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/547864?ContentTypeID=1</link><pubDate>Fri, 05 Sep 2025 07:56:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c738c08-2070-40e0-be9d-946d2629595d</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;This seems to be due to timing between the connected event vs. when the DHCP is bound. Could you try to wait for the DHCP to be bound?&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s a proposed diff:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;diff --git a/src/main.c b/src/main.c
index 7a6f4fe..c675d6c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -37,6 +37,9 @@ LOG_MODULE_REGISTER(sta, CONFIG_LOG_DEFAULT_LEVEL);
 #include &amp;lt;zephyr/net/websocket.h&amp;gt;
 #define SERVER_PORT 3001
 #define SERVER_ADDR4  CONFIG_NET_CONFIG_PEER_IPV4_ADDR
+^M
+static K_SEM_DEFINE(dhcp_bound, 0, 1);^M
+^M
 static int setup_socket(sa_family_t family, const char *server, int port,
                        int *sock, struct sockaddr *addr, socklen_t addr_len)
 {
@@ -333,6 +336,7 @@ static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb,
 {
        switch (mgmt_event) {
        case NET_EVENT_IPV4_DHCP_BOUND:
+               k_sem_give(&amp;amp;dhcp_bound);^M
                print_dhcp_ip(cb);
                break;
        default:
@@ -437,6 +441,8 @@ int start_app(void)
                }
 
                if (context.connected) {
+                       LOG_INF(&amp;quot;Waiting for DHCP to be bound&amp;quot;);^M
+                       k_sem_take(&amp;amp;dhcp_bound, K_FOREVER);^M
                        cmd_wifi_status();
 
                        int err = connect_to_server();&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;File:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/51427.main.c"&gt;devzone.nordicsemi.com/.../51427.main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Log:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.9.1-60d0d6c8d42d ***
*** Using Zephyr OS v3.7.99-ca954a6216c9 ***
[00:00:00.637,329] &amp;lt;inf&amp;gt; net_config: Initializing network
[00:00:00.637,329] &amp;lt;inf&amp;gt; net_config: Waiting interface 1 (0x20000dc8) to be up...
[00:00:00.637,481] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.1.99
[00:00:00.637,542] &amp;lt;inf&amp;gt; net_config: Running dhcpv4 client...
[00:00:00.638,366] &amp;lt;inf&amp;gt; sta: Starting nrf7002dk with CPU frequency: 64 MHz
[00:00:00.640,014] &amp;lt;inf&amp;gt; wifi_supplicant: wpa_supplicant initialized
[00:00:01.638,549] &amp;lt;inf&amp;gt; sta: Static IP address (overridable): 192.168.1.99/255.255.255.0 -&amp;gt; 192.168.1.1
[00:00:03.185,943] &amp;lt;inf&amp;gt; wifi_mgmt_ext: Connection requested
[00:00:03.185,974] &amp;lt;inf&amp;gt; sta: Connection requested
[00:00:03.186,035] &amp;lt;inf&amp;gt; sta: ==================
[00:00:03.186,065] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:03.486,206] &amp;lt;inf&amp;gt; sta: ==================
[00:00:03.486,236] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:03.786,346] &amp;lt;inf&amp;gt; sta: ==================
[00:00:03.786,376] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:04.086,486] &amp;lt;inf&amp;gt; sta: ==================
[00:00:04.086,517] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:04.386,627] &amp;lt;inf&amp;gt; sta: ==================
[00:00:04.386,657] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:04.686,828] &amp;lt;inf&amp;gt; sta: ==================
[00:00:04.686,859] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:04.986,968] &amp;lt;inf&amp;gt; sta: ==================
[00:00:04.986,999] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:05.287,139] &amp;lt;inf&amp;gt; sta: ==================
[00:00:05.287,170] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:05.587,280] &amp;lt;inf&amp;gt; sta: ==================
[00:00:05.587,310] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:05.887,451] &amp;lt;inf&amp;gt; sta: ==================
[00:00:05.887,481] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:06.187,591] &amp;lt;inf&amp;gt; sta: ==================
[00:00:06.187,622] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:06.487,731] &amp;lt;inf&amp;gt; sta: ==================
[00:00:06.487,762] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:06.787,902] &amp;lt;inf&amp;gt; sta: ==================
[00:00:06.787,933] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:07.088,043] &amp;lt;inf&amp;gt; sta: ==================
[00:00:07.088,073] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:07.388,214] &amp;lt;inf&amp;gt; sta: ==================
[00:00:07.388,244] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:07.688,385] &amp;lt;inf&amp;gt; sta: ==================
[00:00:07.688,415] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:07.988,555] &amp;lt;inf&amp;gt; sta: ==================
[00:00:07.988,586] &amp;lt;inf&amp;gt; sta: State: AUTHENTICATING
[00:00:08.288,726] &amp;lt;inf&amp;gt; sta: ==================
[00:00:08.288,757] &amp;lt;inf&amp;gt; sta: State: AUTHENTICATING
[00:00:08.373,504] &amp;lt;inf&amp;gt; sta: Connected
[00:00:08.588,836] &amp;lt;inf&amp;gt; sta: Waiting for DHCP to be bound
[00:00:12.395,080] &amp;lt;inf&amp;gt; net_dhcpv4: Received: 192.168.32.198
[00:00:12.395,263] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.32.198
[00:00:12.395,294] &amp;lt;inf&amp;gt; net_config: Lease time: 36000 seconds
[00:00:12.395,324] &amp;lt;inf&amp;gt; net_config: Subnet: 255.255.255.0
[00:00:12.395,355] &amp;lt;inf&amp;gt; net_config: Router: 192.168.32.1
[00:00:12.395,477] &amp;lt;inf&amp;gt; sta: DHCP IP address: 192.168.32.198
[00:00:12.401,916] &amp;lt;inf&amp;gt; sta: ==================
[00:00:12.401,947] &amp;lt;inf&amp;gt; sta: State: COMPLETED
[00:00:12.401,947] &amp;lt;inf&amp;gt; sta: Interface Mode: STATION
[00:00:12.401,977] &amp;lt;inf&amp;gt; sta: Link Mode: WIFI 6 (802.11ax/HE)
[00:00:12.402,008] &amp;lt;inf&amp;gt; sta: SSID: OpenWrt
[00:00:12.402,038] &amp;lt;inf&amp;gt; sta: BSSID: FC:34:97:0B:F6:DC
[00:00:12.402,069] &amp;lt;inf&amp;gt; sta: Band: 5GHz
[00:00:12.402,069] &amp;lt;inf&amp;gt; sta: Channel: 44
[00:00:12.402,099] &amp;lt;inf&amp;gt; sta: Security: WPA2-PSK
[00:00:12.402,099] &amp;lt;inf&amp;gt; sta: MFP: Optional
[00:00:12.402,130] &amp;lt;inf&amp;gt; sta: RSSI: -61
[00:00:12.402,130] &amp;lt;inf&amp;gt; sta: Try to open as client
[00:00:12.474,487] &amp;lt;inf&amp;gt; sta: Connected
[00:00:12.488,708] &amp;lt;inf&amp;gt; sta: Interface down&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best 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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/547825?ContentTypeID=1</link><pubDate>Fri, 05 Sep 2025 01:50:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8197485-314b-4935-b1c5-4f5fd9ab9e12</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;To make it even more clear - here is the project source showing the main problem. I&amp;#39;m not even calling send_data_to_server() at all anymore, as it&amp;#39;s not the main problem. The main problem is with connect_to_server().&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/wifi_5F00_station_5F00_w_5F00_sockets_5F00_v2.zip"&gt;devzone.nordicsemi.com/.../wifi_5F00_station_5F00_w_5F00_sockets_5F00_v2.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/547824?ContentTypeID=1</link><pubDate>Fri, 05 Sep 2025 01:41:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86e16f4e-a93d-4056-a3f6-0da01739f0bf</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;My lead had me look into the 2 suggestions you had:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:inherit;"&gt;Connect once and send data once&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I have attached an updated project zip, with these changes.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/wifi_5F00_station_5F00_w_5F00_sockets_5F00_v1.zip"&gt;devzone.nordicsemi.com/.../wifi_5F00_station_5F00_w_5F00_sockets_5F00_v1.zip&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;It is still sometimes unable to connect to the server. Whether it was using my server script, your server script, or websocketd, none of them affected this result.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:inherit;"&gt;Use websocketd for testing&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I followed the instructions on the website link:&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I prepared a Linux host machine, with the 3001 port ready for use.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I downloaded websocketd using the following command&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ wget &amp;#39;https://github.com/joewalnes/websocketd/releases/download/v0.3.0/websocketd-0.3.0-linux_amd64.zip&amp;#39;
$ unzip websocketd-0.3.0-linux_amd64.zip&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I ran the command to start the program&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ ./websocketd --port=3001 cat&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I have attached an example of the output from websocketd. This shows multiple attempts of powering on the nRF&amp;rsquo;s and having it send just 1 message.&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;(will upload later; DevZone is reporting errors when I try uploading)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;Note that the Linux host we used is an AWS server that we have been using for multiple other products, for many years. Other than whatever else websocketd sets up, the Linux host and its settings absolutely should not be an issue when it comes to hosting servers.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Both of these suggestions did not work. Not only that, but again they were for addressing other parts of the project that are not the main problem we&amp;rsquo;re facing &amp;ndash; why is it sometimes taking too long to connect to the server? Please address this directly. We will no longer waste time addressing other suggestions like this that lead us down different paths.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/547679?ContentTypeID=1</link><pubDate>Wed, 03 Sep 2025 15:51:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d73bf193-9699-430b-a33b-bd13991ce91f</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Can we have someone w/ more knowledge about this to support us?&amp;nbsp; Obvioously, Hakon is trying to drag out this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/547568?ContentTypeID=1</link><pubDate>Wed, 03 Sep 2025 07:04:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efd9f05d-6ab0-4d93-897a-7a97171979b7</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="esmart-engineering"]The constant &amp;quot;Cannot connect to 192.168.32.166:3001 (err -113)&amp;quot; is not the issue I am talking about[/quote]
&lt;p&gt;Your logs show&amp;nbsp;both -113 and -116.&lt;/p&gt;
[quote user="esmart-engineering"]Please&amp;nbsp;carefully re-examine the exact problem I am talking about. Also pay attention to the other details I&amp;#39;ve shared; for example, the problem occasionally (roughly 50% of the time) occurs.[/quote]
&lt;p&gt;According to the logs that you posted,&amp;nbsp;you are still&amp;nbsp;running in a for-loop. If you look into what the websocket library does, it will create a new socket for each try. This means that you will exhaust the amount of sockets available if you hammer on.&lt;/p&gt;
[quote user="hkn"]However, if you only run the function&amp;nbsp;send_data_to_server() once, it will show:[/quote]
&lt;p&gt;To debug an issue, please take in one step at the time, then adjust when you&amp;#39;re seeing issues.&lt;/p&gt;
&lt;p&gt;This includes trying different scripts, specifically those intended to work with the sample itself, ie. websocketd for instance.&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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/547545?ContentTypeID=1</link><pubDate>Tue, 02 Sep 2025 21:52:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb733f91-02a4-447b-b0be-a60e2c42596b</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Apologies for the late response.&lt;/p&gt;
&lt;p&gt;The constant &amp;quot;Cannot connect to 192.168.32.166:3001 (err -113)&amp;quot; is not the issue I am talking about.&amp;nbsp;&lt;span&gt;My issue is seeing &amp;quot;Cannot connect to IPv4 remote (-116)&amp;quot; which is coming from&amp;nbsp;&lt;/span&gt;connect_to_server(). Please&amp;nbsp;carefully re-examine the exact problem I am talking about. Also pay attention to the other details I&amp;#39;ve shared; for example, the problem occasionally (roughly 50% of the time) occurs.&lt;/p&gt;
&lt;p&gt;Your Python server is set up to receive 1 message, which is not my intention. It should connect to the nRF, receive multiple messages, then require user to Ctrl+C and rerun the server whenever the nRF needs to be run again. I&amp;#39;ve attached my script and an example of what you should see.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/server.py"&gt;devzone.nordicsemi.com/.../server.py&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/server_5F00_log.txt"&gt;devzone.nordicsemi.com/.../server_5F00_log.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I went ahead and tried your configurations anyway, but&amp;nbsp;it did not help with my issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545924?ContentTypeID=1</link><pubDate>Mon, 18 Aug 2025 12:34:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:082b4adb-925d-4c64-9a21-68a9e0ab9c34</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;This is the log that I am seeing:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.9.2-4ab7b98fc76f ***
*** Using Zephyr OS v3.7.99-aa34a5632971 ***
[00:00:00.688,720] &amp;lt;inf&amp;gt; net_config: Initializing network
[00:00:00.688,751] &amp;lt;inf&amp;gt; net_config: Waiting interface 1 (0x20001290) to be up...
[00:00:00.688,903] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.32.99
[00:00:00.688,964] &amp;lt;inf&amp;gt; net_config: Running dhcpv4 client...
[00:00:00.689,788] &amp;lt;inf&amp;gt; sta: Starting nrf7002dk with CPU frequency: 64 MHz
[00:00:00.691,467] &amp;lt;inf&amp;gt; wifi_supplicant: wpa_supplicant initialized
[00:00:01.689,971] &amp;lt;inf&amp;gt; sta: Static IP address (overridable): 192.168.32.99/255.255.255.0 -&amp;gt; 192.168.32.1
[00:00:03.239,898] &amp;lt;inf&amp;gt; wifi_mgmt_ext: Connection requested
[00:00:03.239,929] &amp;lt;inf&amp;gt; sta: Connection requested
[00:00:03.239,990] &amp;lt;inf&amp;gt; sta: ==================
[00:00:03.240,020] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:03.540,161] &amp;lt;inf&amp;gt; sta: ==================
[00:00:03.540,191] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:03.840,332] &amp;lt;inf&amp;gt; sta: ==================
[00:00:03.840,362] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:04.140,502] &amp;lt;inf&amp;gt; sta: ==================
[00:00:04.140,533] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:04.440,673] &amp;lt;inf&amp;gt; sta: ==================
[00:00:04.440,704] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:04.740,844] &amp;lt;inf&amp;gt; sta: ==================
[00:00:04.740,875] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:05.041,015] &amp;lt;inf&amp;gt; sta: ==================
[00:00:05.041,015] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:05.341,186] &amp;lt;inf&amp;gt; sta: ==================
[00:00:05.341,186] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:05.641,326] &amp;lt;inf&amp;gt; sta: ==================
[00:00:05.641,357] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:05.941,528] &amp;lt;inf&amp;gt; sta: ==================
[00:00:05.941,558] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:06.241,668] &amp;lt;inf&amp;gt; sta: ==================
[00:00:06.241,699] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:06.541,870] &amp;lt;inf&amp;gt; sta: ==================
[00:00:06.541,900] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:06.842,041] &amp;lt;inf&amp;gt; sta: ==================
[00:00:06.842,041] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:07.142,211] &amp;lt;inf&amp;gt; sta: ==================
[00:00:07.142,242] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:07.442,352] &amp;lt;inf&amp;gt; sta: ==================
[00:00:07.442,382] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:07.742,523] &amp;lt;inf&amp;gt; sta: ==================
[00:00:07.742,553] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:08.042,724] &amp;lt;inf&amp;gt; sta: ==================
[00:00:08.042,755] &amp;lt;inf&amp;gt; sta: State: AUTHENTICATING
[00:00:08.342,895] &amp;lt;inf&amp;gt; sta: ==================
[00:00:08.342,926] &amp;lt;inf&amp;gt; sta: State: AUTHENTICATING
[00:00:08.452,941] &amp;lt;inf&amp;gt; sta: Connected
[00:00:12.475,097] &amp;lt;inf&amp;gt; net_dhcpv4: Received: 192.168.32.198
[00:00:12.475,280] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.32.198
[00:00:12.475,280] &amp;lt;inf&amp;gt; net_config: Lease time: 36000 seconds
[00:00:12.475,341] &amp;lt;inf&amp;gt; net_config: Subnet: 255.255.255.0
[00:00:12.475,372] &amp;lt;inf&amp;gt; net_config: Router: 192.168.32.1
[00:00:12.475,463] &amp;lt;inf&amp;gt; sta: DHCP IP address: 192.168.32.198
[00:00:12.657,257] &amp;lt;inf&amp;gt; sta: ==================
[00:00:12.657,287] &amp;lt;inf&amp;gt; sta: State: COMPLETED
[00:00:12.657,318] &amp;lt;inf&amp;gt; sta: Interface Mode: STATION
[00:00:12.657,348] &amp;lt;inf&amp;gt; sta: Link Mode: WIFI 6 (802.11ax/HE)
[00:00:12.657,379] &amp;lt;inf&amp;gt; sta: SSID: OpenWrt
[00:00:12.657,409] &amp;lt;inf&amp;gt; sta: BSSID: FC:34:97:0B:F6:DC
[00:00:12.657,409] &amp;lt;inf&amp;gt; sta: Band: 5GHz
[00:00:12.657,440] &amp;lt;inf&amp;gt; sta: Channel: 44
[00:00:12.657,440] &amp;lt;inf&amp;gt; sta: Security: WPA2-PSK
[00:00:12.657,470] &amp;lt;inf&amp;gt; sta: MFP: Optional
[00:00:12.657,470] &amp;lt;inf&amp;gt; sta: RSSI: -60
[00:00:13.657,562] &amp;lt;inf&amp;gt; sta: Try to open as client
[00:00:13.740,417] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.740,417] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.740,905] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.740,905] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.741,363] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.741,363] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.741,821] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.741,851] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.742,309] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.742,309] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.742,767] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.742,797] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.743,255] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.743,255] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.743,713] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.743,713] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.744,201] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.744,201] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.744,659] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.744,659] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:13.766,021] &amp;lt;inf&amp;gt; sta: Interface down
[00:00:13.766,143] &amp;lt;inf&amp;gt; wifi_supplicant: Network interface 1 (0x20001290) down
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;On the server side, I am running a small py script just to setup a server on port 3001:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#! /usr/bin/python
# a simple tcp server
import socket,os
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind((&amp;#39;192.168.32.166&amp;#39;, 3001))
sock.listen(5)
while True:
    connection,address = sock.accept()
    buf = connection.recv(1024)
    print(buf)
    connection.send(buf)     
    connection.close()&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which prints this each time I connect:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;b&amp;#39;GET / HTTP/1.1\r\nHost: 192.168.32.166\r\nOrigin: http://foobar\r\nSec-WebSocket-Key: lm0W7zOrdWFToQCN8Kkcmg==\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Version: 13\r\n\r\n&amp;#39;&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Running the websocketd as described here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/latest/samples/net/sockets/websocket_client/README.html#running-websocket-server-in-linux-host"&gt;https://docs.zephyrproject.org/latest/samples/net/sockets/websocket_client/README.html#running-websocket-server-in-linux-host&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Shows similar issues as before, ie. that the log spits out:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:13.955,291] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:13.955,291] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.078,338] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.078,338] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.178,863] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.178,894] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.279,449] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.279,449] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.380,004] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.380,035] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.480,621] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.480,651] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.581,207] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.581,237] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.681,793] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.681,793] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.782,348] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.782,379] &amp;lt;err&amp;gt; sta: No IPv4 connectivity
[00:00:14.882,934] &amp;lt;err&amp;gt; sta: Cannot connect to 192.168.32.166:3001 (err -113)
[00:00:14.882,934] &amp;lt;err&amp;gt; sta: No IPv4 connectivity&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, if you only run the function&amp;nbsp;send_data_to_server() once, it will show:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v2.9.2-4ab7b98fc76f ***
*** Using Zephyr OS v3.7.99-aa34a5632971 ***
[00:00:00.638,793] &amp;lt;inf&amp;gt; net_config: Initializing network
[00:00:00.638,793] &amp;lt;inf&amp;gt; net_config: Waiting interface 1 (0x20000d98) to be up...
[00:00:00.638,977] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.32.99
[00:00:00.639,007] &amp;lt;inf&amp;gt; net_config: Running dhcpv4 client...
[00:00:00.639,953] &amp;lt;inf&amp;gt; sta: Starting nrf7002dk with CPU frequency: 64 MHz
[00:00:00.641,845] &amp;lt;inf&amp;gt; wifi_supplicant: wpa_supplicant initialized
[00:00:01.640,136] &amp;lt;inf&amp;gt; sta: Static IP address (overridable): 192.168.32.99/255.255.255.0 -&amp;gt; 192.168.32.1
[00:00:03.560,089] &amp;lt;inf&amp;gt; wifi_mgmt_ext: Connection requested
[00:00:03.560,119] &amp;lt;inf&amp;gt; sta: Connection requested
[00:00:03.560,180] &amp;lt;inf&amp;gt; sta: ==================
[00:00:03.560,211] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:08.062,774] &amp;lt;inf&amp;gt; sta: ==================
[00:00:08.062,774] &amp;lt;inf&amp;gt; sta: State: SCANNING
[00:00:08.362,945] &amp;lt;inf&amp;gt; sta: ==================
[00:00:08.362,976] &amp;lt;inf&amp;gt; sta: State: AUTHENTICATING
[00:00:08.663,116] &amp;lt;inf&amp;gt; sta: ==================
[00:00:08.663,146] &amp;lt;inf&amp;gt; sta: State: AUTHENTICATING
[00:00:08.730,682] &amp;lt;inf&amp;gt; sta: Connected
[00:00:12.988,555] &amp;lt;inf&amp;gt; sta: ==================
[00:00:12.988,586] &amp;lt;inf&amp;gt; sta: State: COMPLETED
[00:00:12.988,616] &amp;lt;inf&amp;gt; sta: Interface Mode: STATION
[00:00:12.988,647] &amp;lt;inf&amp;gt; sta: Link Mode: WIFI 6 (802.11ax/HE)
[00:00:12.988,647] &amp;lt;inf&amp;gt; sta: SSID: OpenWrt
[00:00:12.988,677] &amp;lt;inf&amp;gt; sta: BSSID: FC:34:97:0B:F6:DC
[00:00:12.988,708] &amp;lt;inf&amp;gt; sta: Band: 5GHz
[00:00:12.988,708] &amp;lt;inf&amp;gt; sta: Channel: 44
[00:00:12.988,739] &amp;lt;inf&amp;gt; sta: Security: WPA2-PSK
[00:00:12.988,769] &amp;lt;inf&amp;gt; sta: MFP: Optional
[00:00:12.988,769] &amp;lt;inf&amp;gt; sta: RSSI: -55
[00:00:13.752,960] &amp;lt;inf&amp;gt; net_dhcpv4: Received: 192.168.32.198
[00:00:13.753,143] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.32.198
[00:00:13.753,173] &amp;lt;inf&amp;gt; net_config: Lease time: 36000 seconds
[00:00:13.753,204] &amp;lt;inf&amp;gt; net_config: Subnet: 255.255.255.0
[00:00:13.753,234] &amp;lt;inf&amp;gt; net_config: Router: 192.168.32.1
[00:00:13.753,356] &amp;lt;inf&amp;gt; sta: DHCP IP address: 192.168.32.198
[00:00:13.988,830] &amp;lt;inf&amp;gt; sta: Try to open as client
[00:00:14.059,570] &amp;lt;err&amp;gt; sta: 12
[00:00:14.069,183] &amp;lt;inf&amp;gt; sta: Websocket 13 for IPv4 connected.
[00:00:14.069,183] &amp;lt;inf&amp;gt; sta: Websocket IPv4 13
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I added these configurations to maximize the amount of sockets / net contexts:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_ZVFS_OPEN_MAX=20
CONFIG_NET_SOCKETS_POLL_MAX=20
CONFIG_NET_CONFIG_NEED_IPV6=n
CONFIG_NET_IPV6=n
CONFIG_NET_MAX_CONTEXTS=20
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Could you try the same and see if it runs accordingly?&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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545719?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 22:36:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff6c0778-cb38-4a0d-8ce0-b14c10a14b27</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Could be a RAM issue, but I also tested on an nRF7002DK (using nRF53 which has 2x RAM as nRF52) and saw the same issue.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve attached the whole project here you can use. Please build based off the build configuration presets I have for the nRF52+nRF70, as well as the nRF7002DK I just tried.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/wifi_5F00_station_5F00_w_5F00_sockets.zip"&gt;devzone.nordicsemi.com/.../wifi_5F00_station_5F00_w_5F00_sockets.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545641?ContentTypeID=1</link><pubDate>Thu, 14 Aug 2025 09:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26f25c78-fd0c-4e96-ab08-998d772666f4</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="esmart-engineering"]My log is from before making the change,[/quote]
&lt;p&gt;It is important that you disclose such information when posting, to avoid any confusion, such is the scenario right now.&lt;/p&gt;
[quote user="esmart-engineering"]It has been a week since the posting and we&amp;#39;ve only gotten small suggestions that are not helping whatsoever. Please look into this more in depth and give us a solid concrete solution for us to try.[/quote]
&lt;p&gt;I understand that this issue is blocking your evaluation and development, and I aim to help you with this. However, I am going to stress this as much as I can, please do not truncate any information that you share on devzone. Logs show warnings and errors, and leaving them out makes it hard to be able to help you.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you please share your configurations and settings, so I can recreate this in the STA sample?&lt;/p&gt;
&lt;p&gt;You are combining the nRF52840 with the nRF7002, which is a tight fit wrt. RAM, meaning that it needs to be optimized quite heavily.&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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545584?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 20:17:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23e40f26-6d23-4d68-aa80-9d8efa41f759</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;It has been a week since the posting and we&amp;#39;ve only gotten small suggestions that are not helping whatsoever. Please look into this more in depth and give us a solid concrete solution for us to try.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545576?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 18:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecec435f-6d0b-42bd-ace0-cf822de2b61b</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;As I already mentioned, the issue was resolved with&amp;nbsp;&lt;span&gt;CONFIG_NET_PKT_TX_COUNT. My log is from before making the change, but the log does not differ much with or without the change. And again&amp;nbsp;it does not resolve my primary issue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I also tried&amp;nbsp;CONFIG_NET_BUF_DATA_SIZE (to 256, 512, and 4096) and none of these fixed the packet allocation issues like&amp;nbsp;CONFIG_NET_PKT_TX_COUNT did.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If by &amp;quot;NET_PKT configuration&amp;quot;, you mean KConfig flags related to &amp;quot;NET_PKT&amp;quot;, then I have&amp;nbsp;&lt;/span&gt;&lt;span&gt;CONFIG_NET_PKT_RX_COUNT&lt;/span&gt;&lt;span&gt;=8 and&amp;nbsp;&lt;/span&gt;&lt;span&gt;CONFIG_NET_PKT_TX_COUNT&lt;/span&gt;&lt;span&gt;=16 explicitly stated in my &amp;quot;prj.conf&amp;quot; file. The following is what I see in my build output &amp;quot;.config&amp;quot; file:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NET_PKT_RX_COUNT=8
CONFIG_NET_PKT_TX_COUNT=16
...
# CONFIG_NET_PKT_TXTIME is not set
# CONFIG_NET_PKT_TIMESTAMP is not set
...
# CONFIG_NET_CONTEXT_NET_PKT_POOL is not set
...
CONFIG_NET_PKT_BUF_RX_DATA_POOL_SIZE=4096
CONFIG_NET_PKT_BUF_TX_DATA_POOL_SIZE=4096
CONFIG_NET_PKT_BUF_USER_DATA_SIZE=4
...
# CONFIG_NET_PKT_RXTIME_STATS is not set
# CONFIG_NET_PKT_TXTIME_STATS is not set
...
# CONFIG_NET_PKT_LOG_LEVEL_OFF is not set
# CONFIG_NET_PKT_LOG_LEVEL_ERR is not set
# CONFIG_NET_PKT_LOG_LEVEL_WRN is not set
# CONFIG_NET_PKT_LOG_LEVEL_INF is not set
# CONFIG_NET_PKT_LOG_LEVEL_DBG is not set
CONFIG_NET_PKT_LOG_LEVEL_DEFAULT=y
CONFIG_NET_PKT_LOG_LEVEL=3
# CONFIG_NET_DEBUG_NET_PKT_ALLOC is not set
CONFIG_NET_DEBUG_NET_PKT_EXTERNALS=0
# CONFIG_NET_DEBUG_NET_PKT_NON_FRAGILE_ACCESS is not set
...
# CONFIG_NET_PKT_FILTER is not set
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-------&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;EDIT #1 -&amp;nbsp;Here&amp;#39;s another log, with complete output and with the&amp;nbsp;CONFIG_NET_PKT_TX_COUNT=16 fix.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/websocket_5F00_log2.txt"&gt;devzone.nordicsemi.com/.../websocket_5F00_log2.txt&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545548?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 14:02:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26e44e13-0e7c-4950-88e7-8660fa7b737f</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;You still have packet allocation issues, based on your latest log.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:09.321,838] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:09.626,037] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:09.930,236] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What NET_PKT configuration did you end up using?&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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545419?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2025 15:55:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88437a78-ec74-4713-a7ed-c9aff710f4e5</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Server reports it connected to nRF with an IP 192.168.101.x&lt;/p&gt;
&lt;p&gt;Log only had the following removed. Apologies. Initially it was to avoid confusion on when the nRF connected to the socket, but looking at it now it could be relevant:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;...

[00:00:09.321,838] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:09.626,037] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:09.930,236] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:10.864,440] &amp;lt;inf&amp;gt; net_dhcpv4: Received: 192.168.101.143
[00:00:10.864,654] &amp;lt;inf&amp;gt; net_config: IPv4 address: 192.168.101.143
[00:00:10.864,685] &amp;lt;inf&amp;gt; net_config: Lease time: 86400 seconds
[00:00:10.864,715] &amp;lt;inf&amp;gt; net_config: Subnet: 255.255.255.0
[00:00:10.864,776] &amp;lt;inf&amp;gt; net_config: Router: 192.168.101.1
[00:00:10.864,898] &amp;lt;inf&amp;gt; sta: DHCP IP address: 192.168.101.143
[00:00:10.951,232] &amp;lt;err&amp;gt; sta: Cannot connect to IPv4 remote (-116)
[00:00:10.951,232] &amp;lt;err&amp;gt; sta: Cannot create HTTP connection.
[00:00:12.052,185] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:15.052,337] &amp;lt;err&amp;gt; sta: Cannot connect to IPv4 remote (-116)
[00:00:15.052,337] &amp;lt;err&amp;gt; sta: Cannot create HTTP connection.
...&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regardless, logs indicate 3sec in this particular case between attempting to connect to socket, and receiving the 192.168.101.x IP address. This seems too long.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545362?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2025 11:47:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:860f52cf-aea3-49c1-91a9-12f5ad845868</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;Can you confirm that you&amp;#39;re receiving an IP within 192.168.101.x range? Or with a netmask of 255.255.0.0 if in the 192.168.x.x range?&lt;/p&gt;
&lt;p&gt;Could you please share the full log, and do not take out any of the lines? Feel free to redact the SSID for instance.&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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545332?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2025 09:04:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ae99eeb-bfbd-4a7e-8936-48b7b66c625a</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;I already have&amp;nbsp;&lt;span&gt;CONFIG_NET_DHCPV4&lt;/span&gt;&lt;span&gt;=y. In addition, I had these which probably explain the IP&amp;#39;s/masks in the log:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;CONFIG_NET_CONFIG_MY_IPV4_ADDR&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&lt;span&gt;&amp;quot;192.168.1.99&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;CONFIG_NET_CONFIG_MY_IPV4_NETMASK&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;quot;255.255.255.0&amp;quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;CONFIG_NET_CONFIG_MY_IPV4_GW&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;quot;192.168.1.1&amp;quot;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545326?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2025 08:47:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39b77272-9a44-4f35-9e6a-c921909114e3</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;You&amp;#39;re connecting to a server on 192.168.101.x, have you enabled DHCPv4 on the nRF side?&lt;/p&gt;
&lt;p&gt;If not, it will default to this IP and mask:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;....[00:00:01.774,780] &amp;lt;inf&amp;gt; sta: Static IP address (overridable): 192.168.1.99/255.255.255.0 -&amp;gt; 192.168.1.1
&lt;/pre&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><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545321?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2025 07:58:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d3bd277-07ce-423f-904b-57efff864d90</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;Socket is created and a connection is established in connect_to_server().&lt;/p&gt;
&lt;p&gt;I will try those KConfig flags when I get in the office next. I previously increased&amp;nbsp;&lt;span&gt;CONFIG_NET_PKT_TX_COUNT from 8 to 16, and this removed those &amp;quot;alloc failure&amp;quot; messages. But the problem still persists.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545314?ContentTypeID=1</link><pubDate>Tue, 12 Aug 2025 07:24:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cc78cdc-744b-4798-a971-01a57e2ccc37</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;Where is your socket created?&lt;/p&gt;
&lt;p&gt;The log lines here indicate that the network stack isn&amp;#39;t able to allocate data:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:09.321,838] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:09.626,037] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure
[00:00:09.930,236] &amp;lt;wrn&amp;gt; net_tcp: net_pkt alloc failure&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can try to adjust the buf size via &amp;quot;CONFIG_NET_BUF_DATA_SIZE&amp;quot;, or you can switch do a variable data size buffer for the net stack via &amp;quot;CONFIG_NET_BUF_VARIABLE_DATA_SIZE=y&amp;quot;.&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: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/545098?ContentTypeID=1</link><pubDate>Sat, 09 Aug 2025 03:10:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d582de53-d668-4867-a950-1989a701f92a</guid><dc:creator>esmart-engineering</dc:creator><description>&lt;p&gt;I tested closing my socket after use but it did not help.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the relevant code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int sock4 = -1;

static int wifi_connect(void) { // same definition as WiFi station example }

static int wifi_shutdown(void)
{   // based off NCS v2.9.1 (nrf/samples/wifi/shutdown)
	int ret;
	struct net_if *iface = net_if_get_default();

	if (!net_if_is_admin_up(iface)) {
		return 0;
	}

	ret = net_if_down(iface);
	if (ret) {
		LOG_ERR(&amp;quot;Cannot bring down iface (%d)&amp;quot;, ret);
		return ret;
	}

	LOG_INF(&amp;quot;Interface down&amp;quot;);

	return 0;
}

int connect_to_server(void)
{   // based off Websocket client example
    
	struct sockaddr_in addr4;
	size_t amount;
	int ret = -1;

	LOG_INF(&amp;quot;Try to open as client&amp;quot;);
	while (ret &amp;lt; 0) {
		if (IS_ENABLED(CONFIG_NET_IPV4)) {
			ret = connect_socket(AF_INET, SERVER_ADDR4, SERVER_PORT,
						&amp;amp;sock4, (struct sockaddr *)&amp;amp;addr4,
						sizeof(addr4));
		}
		if (sock4 &amp;lt; 0 || ret &amp;lt; 0) {
			LOG_ERR(&amp;quot;Cannot create HTTP connection.&amp;quot;);
			k_sleep(K_SECONDS(1));
		}
	}
}

int send_data_to_server(void)
{   // based off Websocket client example

	/* Just an example how to set extra headers */
	const char *extra_headers[] = {
		&amp;quot;Origin: http://foobar\r\n&amp;quot;,
		NULL
	};
	int websock4 = -1;
	int32_t timeout = 150;	// units [ms]

	if (sock4 &amp;gt;= 0 &amp;amp;&amp;amp; IS_ENABLED(CONFIG_NET_IPV4)) {
		struct websocket_request req;

		memset(&amp;amp;req, 0, sizeof(req));

		req.host = SERVER_ADDR4;
		req.url = &amp;quot;/&amp;quot;;
		req.optional_headers = extra_headers;
		req.cb = connect_cb;
		req.tmp_buf = temp_recv_buf_ipv4;
		req.tmp_buf_len = sizeof(temp_recv_buf_ipv4);

		websock4 = websocket_connect(sock4, &amp;amp;req, timeout, &amp;quot;IPv4&amp;quot;);
		if (websock4 &amp;lt; 0) {
			LOG_ERR(&amp;quot;Cannot connect to %s:%d (err %d)&amp;quot;,
				SERVER_ADDR4, SERVER_PORT,
				websock4);
			// close(sock4);
		}
	}
	if (websock4 &amp;lt; 0) {
		LOG_ERR(&amp;quot;No IPv4 connectivity&amp;quot;);
		return -2;
	}
	LOG_INF(&amp;quot;Websocket IPv4 %d&amp;quot;, websock4);
}

int start_app(void)
{       // main() calls this; my main() has same definition as main() from WiFi station example
	LOG_INF(&amp;quot;Static IP address (overridable): %s/%s -&amp;gt; %s&amp;quot;,
		CONFIG_NET_CONFIG_MY_IPV4_ADDR,
		CONFIG_NET_CONFIG_MY_IPV4_NETMASK,
		CONFIG_NET_CONFIG_MY_IPV4_GW);
		
	while (1) {
	    wifi_connect();

		while (!context.connect_result) {
			cmd_wifi_status();
			k_sleep(K_MSEC(STATUS_POLLING_MS));
		}

		if (context.connected) {
			cmd_wifi_status();

			connect_to_server();
			
			// Send data multiple times
			for (uint8_t i = 0; i &amp;lt; 10; i ++) {
			    send_data_to_server();
			}
			
			// Close socket
			    // NOTE - didn&amp;#39;t try with websock4, since I see &amp;quot;No IPv4 connectivity&amp;quot; log output
			if (sock4 &amp;gt;= 0) {
			    close(sock4);
			}

			wifi_shutdown();
			k_sleep(K_SECONDS(1));

			sys_poweroff();
		}
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the log I get:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/websocket_5F00_log.txt"&gt;devzone.nordicsemi.com/.../websocket_5F00_log.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Again, for context:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I call connect() multiple times because there&amp;#39;s a timeout in trying to connect; it&amp;#39;s confirmed on my server too that no connection is established.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;I see the attempt to connect to socket will timeout if I see &amp;quot;Cannot connect to IPv4 remote (-116)&amp;quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size:75%;"&gt;The data arrives on the server if I see &amp;quot; Cannot connect to 192.168.101.98:3001 (err -113)&amp;quot;. The message is misleading but my server does receive data.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Websocket connection has timeout too frequently</title><link>https://devzone.nordicsemi.com/thread/544941?ContentTypeID=1</link><pubDate>Thu, 07 Aug 2025 12:57:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2229bd48-20d4-4394-8817-3ba689874751</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=""]&lt;p&gt;Functionally my code is working: able to connect to WiFi, connect to socket, and send some data. For sending data, I&amp;#39;m having it repeatedly call websocket_connect(); it will return with an error but my server still gets the data (which is acceptable at this time of evaluation).&lt;/p&gt;
&lt;p&gt;However, once my code gets to the connect() call as part of connect_socket(), it will occasionally (roughly 50% of the time) timeout after the default 3sec. I modified it to repeatedly call connect() until it succeeds, and noticed it may take 2-3 tries to connect. But this means that it&amp;#39;s taking almost 10sec at most just to simply connect to a socket.&lt;/p&gt;[/quote]
&lt;p&gt;Can you share logs and relevant code for this procedure?&lt;/p&gt;
&lt;p&gt;Are you closing your sockets after use?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are already connected via a socket, you should not run connect() multiple times.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Note that I also tried one of Nordic&amp;#39;s official networking samples - the HTTPS client one (NCS v2.9.1, nrf/samples/net/https_client).[/quote]
&lt;p&gt;This sample does not have support for the board combination that you&amp;#39;re using:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/net/https_client/README.html#requirements"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/net/https_client/README.html#requirements&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>