<?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>TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96365/tls-socket-connection-request-return-with-error-number--22-einval</link><description>Hi All, 
 I am trying to setup a thread network to send RPC message to a remote http server: https://mainnet.incubed.net ). I took http_client sample(sdk-zephyr) and modified slightly to adapt to my application. . 
 I was successful in sending RPC message</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Jun 2023 22:23:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96365/tls-socket-connection-request-return-with-error-number--22-einval" /><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/432785?ContentTypeID=1</link><pubDate>Fri, 23 Jun 2023 22:23:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a897c52-1623-410d-91d0-e07e451bdb47</guid><dc:creator>erichotterbeefcurry</dc:creator><description>&lt;p&gt;Thank you for the fast response Vipin! I will check it out, hopefully it works haha&lt;/p&gt;
&lt;p&gt;-Eric&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/432784?ContentTypeID=1</link><pubDate>Fri, 23 Jun 2023 22:20:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f253dce-1924-483b-8edd-35868b637fdc</guid><dc:creator>vipin das</dc:creator><description>&lt;p&gt;Hi Eric,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes I think I resolved all the issues that I faced with respect to TLS socket connection. Please take a look at the my another discussion thread.&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/98977/psa_generate_key-failed-with-error--134"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/98977/psa_generate_key-failed-with-error--134&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The above mentioned issue will get resolved if you update the software environment to&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;ZEPHYR_SDK_VERSION : 0.15.2&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;NCS: &lt;/span&gt;v2.2.99-dev3&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;But you might face another issue if you wanted to use. both PSA and WPA_SUPPLICANT in your application. I have described my problem in the above given ticket.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Thanks&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Vipin Das&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/432782?ContentTypeID=1</link><pubDate>Fri, 23 Jun 2023 21:46:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bd66026-d3b4-484e-b28d-fdf08f172541</guid><dc:creator>erichotterbeefcurry</dc:creator><description>&lt;p&gt;Hi Vipin, I am getting a 22 err code when I connect using TLS socket, I&amp;#39;m wondering if you have made any progress on this issue since posting? I am using a nrf7002DK and followed the nrf https sample to write my code. Thanks!&lt;/p&gt;
&lt;p&gt;-Eric&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/411687?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 14:13:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a662002-e0ab-4680-a169-ee3dbe01bbfa</guid><dc:creator>vipin das</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Honestly speaking, I had tried both the implementation. The good thing is that both gives the same error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One interesting thing that I noticed now is when I try to open a socket as below throws error for setsockopt()&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;*sock = &lt;/span&gt;&lt;span&gt;socket&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;res&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ai_family&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;res&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ai_socktype&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;res&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ai_protocol&lt;/span&gt;&lt;span&gt;);&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:33.839,416] &amp;lt;dbg&amp;gt; net_sock: zsock_socket_internal: (main): socket: ctx=0x20010ae4, fd=0
[00:00:33.839,447] &amp;lt;err&amp;gt; http_client: Failed to setup peer verification, err -109

[00:00:33.839,477] &amp;lt;err&amp;gt; http_client: Establishing socket connection failed
[00:00:33.839,477] &amp;lt;err&amp;gt; http_client: Setup socket connection failed
[00:00:33.839,508] &amp;lt;dbg&amp;gt; net_sock: z_impl_zsock_close: (main): close: ctx=0x20010ae4, fd=0&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;But when I use&amp;nbsp;*sock = socket(res-&amp;gt;ai_family, res-&amp;gt;ai_socktype,IPPROTO_TLS_1_2), then I can see socket is opening but network connection fails with -22. Right now I am trying to connect to google.com.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Could you please check that &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;socket&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;res&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ai_family(AF_INET6)&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;res&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;ai_socktype(SOCK_STREAM)&lt;/span&gt;&lt;span&gt;, res-&amp;gt;ai_socktype(IPPROTO_TLS_1_2)) works fine or should I have to&amp;nbsp;handle differently.&amp;nbsp;&lt;/span&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;I will try again for sniffer as you mentioned. I am using nRF52840 dongle.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;Vipin Das&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/411675?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 13:48:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26b60212-c1cb-47be-82b4-76affc5d20d1</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t see any obvious problem in your code. Can you have a look at the code in the &lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/main/samples/nrf9160/https_client"&gt;https_client sample&lt;/a&gt;&amp;nbsp;in the sdk-nrf repo, to see if this works for you? This is written for nRF9160, but it uses sockets like the example you already based on, so it should be similar modifications needed to make it work with OpenThread.&lt;/p&gt;
&lt;p&gt;Also, if you can retry setup of the Sniffer, that will probably help figure out what is failing. I recommend using the nRF52840 Dongle with the sniffer (or nRF52840 DK connected through the NRF_USB port). Make sure you program the sniffer firmware before opening Wireshark, and run the Python command as described in &lt;a href="https://infocenter.nordicsemi.com/topic/ug_sniffer_802154/UG/sniffer_802154/installing_sniffer_802154_plugin.html"&gt;step 3 in the installation guide&lt;/a&gt; to make sure no errors are reported from Python, and that the interface is detected correctly.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/411620?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 10:35:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0c4d4f3-834b-4395-b7c6-94a8cb130fd6</guid><dc:creator>vipin das</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The TLS handshake issue with error code -7780 got fixed after changing the PEM(cert) with PEM(chain) certificate and also enabled some MBEDTLS security config options.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED=y
CONFIG_MBEDTLS_MAC_SHA256_ENABLED=y
CONFIG_MBEDTLS_HASH_SHA256_ENABLED=y
CONFIG_MBEDTLS_CIPHER_AES_ENABLED=y
CONFIG_MBEDTLS_CIPHER_GCM_ENABLED=y
CONFIG_MBEDTLS_CIPHER_MODE_CBC=y
CONFIG_MBEDTLS_CIPHER_MODE_CBC_ENABLED=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But again I am back to my previous error state. By the way did you find any problem with my code snippet I shared? If you can comment on that I could find some clue on the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:01:07.141,326] &amp;lt;dbg&amp;gt; net_sock: zsock_socket_internal: (main): socket: ctx=0x20010ae0, fd=1
[00:01:07.141,326] &amp;lt;dbg&amp;gt; http_client: establish_connection_ipv6: TLS Socket fd: 0
[00:01:07.141,510] &amp;lt;dbg&amp;gt; net_ctx: net_context_bind: (main): Context 0x20010ae0 binding to TCP [::]:33530 iface 1 (0x20000ac0)
[00:01:07.141,601] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_connect: (main): context: 0x20010ae0, local: ::, remote: fd97:6739:93e:2::808:808
[00:01:07.141,784] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_connect: (main): conn: 0x2002fe28 src: fd97:6739:93e:1:4ea8:498f:5004:da95, dst: fd97:6739:93e:2::808:808
[00:01:07.141,906] &amp;lt;dbg&amp;gt; net_conn: conn_register_debug: (main): [0x2001108c/6/2/0x3f] remote fd97:6739:93e:2::808:808/443 
[00:01:07.141,967] &amp;lt;dbg&amp;gt; net_conn: conn_register_debug: (main):   local ::/33530 cb 0x17e51 ud 0x20010ae0
[00:01:07.142,089] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (main):  [LISTEN Seq=384814854 Ack=0]
[00:01:07.142,364] &amp;lt;dbg&amp;gt; net_tcp: tcp_out_ext: (main): SYN Seq=384814854 Len=0
[00:01:07.142,517] &amp;lt;dbg&amp;gt; net_tcp: tcp_send_process_no_lock: (main): SYN Seq=384814854 Len=0 
[00:01:07.142,730] &amp;lt;dbg&amp;gt; net_tcp: tcp_send: (main): SYN Seq=384814854 Len=0
[00:01:07.143,096] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (main): LISTEN-&amp;gt;SYN_SENT
[00:01:07.190,002] &amp;lt;dbg&amp;gt; in3_ot: pingResponseCallback: Ping reply
[00:01:07.190,032] &amp;lt;dbg&amp;gt; in3_ot: printIpv6Address: Mesh Local EID Address: fd97.6739.093e.0002.0000.0000.0808.0808
[00:01:07.196,014] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): Check TCP listener for pkt 0x2002f1d8 src port 443 dst port 33530 family 2
[00:01:07.196,044] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): [0x2001108c] match found cb 0x17e51 ud 0x20010ae0 rank 0x3f
[00:01:07.196,380] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): SYN,ACK Seq=1435167008 Ack=384814855 Len=0 [SYN_SENT Seq=384814855 Ack=0]
[00:01:07.196,441] &amp;lt;dbg&amp;gt; net_tcp: tcp_options_check: (rx_q[0]): len=4
[00:01:07.196,441] &amp;lt;dbg&amp;gt; net_tcp: tcp_options_check: (rx_q[0]): opt: 2, opt_len: 4
[00:01:07.196,472] &amp;lt;dbg&amp;gt; net_tcp: tcp_options_check: (rx_q[0]): MSS=1412
[00:01:07.196,502] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): Lowering send window from 65535 to 1280
[00:01:07.196,533] &amp;lt;dbg&amp;gt; net_tcp: tcp_window_full: (rx_q[0]): conn: 0x2002fe28 window_full=0
[00:01:07.196,685] &amp;lt;dbg&amp;gt; net_tcp: tcp_send_timer_cancel: (rx_q[0]): SYN Seq=384814854 Len=0
[00:01:07.196,990] &amp;lt;dbg&amp;gt; net_tcp: tcp_out_ext: (rx_q[0]): ACK Seq=384814855 Ack=1435167009 Len=0
[00:01:07.197,204] &amp;lt;dbg&amp;gt; net_tcp: tcp_send_process_no_lock: (rx_q[0]): ACK Seq=384814855 Ack=1435167009 Len=0 
[00:01:07.197,387] &amp;lt;dbg&amp;gt; net_tcp: tcp_send: (rx_q[0]): ACK Seq=384814855 Ack=1435167009 Len=0
[00:01:07.197,509] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): SYN_SENT-&amp;gt;ESTABLISHED
[00:01:07.197,723] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_connect: (main): conn: 0x2002fe28, ret=0
[00:01:07.197,784] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_recv: (main): context: 0x20010ae0, cb: 0x8d45, user_data: (nil)
[00:01:07.262,359] &amp;lt;err&amp;gt; http_client: Cannot connect to ipv6 remote (-22)
[00:01:07.262,390] &amp;lt;err&amp;gt; http_client: Establishing socket connection failed
[00:01:07.262,390] &amp;lt;err&amp;gt; http_client: Setup socket connection failed&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Vipin Das&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/411600?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 10:04:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01b1c623-5d77-4be9-b4d7-adb0b0b38c21</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the slow response. I see that you marked the previous answer as verified answer, does this mean that you managed to resolve the issue? If so, can you post the solution for other users looking for the same thing?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/411072?ContentTypeID=1</link><pubDate>Tue, 21 Feb 2023 11:09:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97305626-eb37-4866-82fa-07a65348627c</guid><dc:creator>vipin das</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;/span&gt;&lt;span&gt;J&amp;oslash;rgen,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Any comments on my last question.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vipin Das&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/409958?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2023 21:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85989604-2879-4de4-95db-eebd986df829</guid><dc:creator>vipin das</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks!!!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Before I post my query, I have seen the above mentioned discussion and tried some of the configuration changes but nothing helps.&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But I tried to connect to &amp;quot;google.com&amp;quot; using the same code, here I don&amp;#39;t see any TLS handshake issue but socket connect is failed here as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:37.959,228] &amp;lt;dbg&amp;gt; http_client: establish_connection: ai_family: 2 ai_socktype: 1 ai_protocol: 6 ai_addrlen: 24
[00:00:37.959,411] &amp;lt;dbg&amp;gt; net_sock_tls: tls_alloc: (main): Allocated TLS context, 0x200034b0
[00:00:37.959,686] &amp;lt;dbg&amp;gt; net_tcp: tcp_conn_ref: (main): conn: 0x20030100, ref_count: 1
[00:00:37.959,716] &amp;lt;dbg&amp;gt; net_tcp: tcp_conn_alloc: (main): conn: 0x20030100
[00:00:37.959,777] &amp;lt;dbg&amp;gt; net_sock: zsock_socket_internal: (main): socket: ctx=0x200103c8, fd=1
[00:00:37.959,808] &amp;lt;dbg&amp;gt; http_client: establish_connection: TLS Socket fd: 0
[00:00:37.959,960] &amp;lt;dbg&amp;gt; net_ctx: net_context_bind: (main): Context 0x200103c8 binding to TCP [::]:37717 iface 1 (0x20000ab8)
[00:00:37.960,083] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_connect: (main): context: 0x200103c8, local: ::, remote: fd97:6739:93e:2::808:808
[00:00:37.960,235] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_connect: (main): conn: 0x20030100 src: fd97:6739:93e:1:99b4:2ddc:2e2b:7ac1, dst: fd97:6739:93e:2::808:808
[00:00:37.960,388] &amp;lt;dbg&amp;gt; net_conn: conn_register_debug: (main): [0x20010974/6/2/0x3f] remote fd97:6739:93e:2::808:808/443 
[00:00:37.960,418] &amp;lt;dbg&amp;gt; net_conn: conn_register_debug: (main):   local ::/37717 cb 0x18045 ud 0x200103c8
[00:00:37.960,571] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (main):  [LISTEN Seq=3072386416 Ack=0]
[00:00:37.960,815] &amp;lt;dbg&amp;gt; net_tcp: tcp_out_ext: (main): SYN Seq=3072386416 Len=0
[00:00:37.960,968] &amp;lt;dbg&amp;gt; net_tcp: tcp_send_process_no_lock: (main): SYN Seq=3072386416 Len=0 
[00:00:37.961,181] &amp;lt;dbg&amp;gt; net_tcp: tcp_send: (main): SYN Seq=3072386416 Len=0
[00:00:37.961,578] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (main): LISTEN-&amp;gt;SYN_SENT
[00:00:38.013,000] &amp;lt;dbg&amp;gt; in3_ot: pingResponseCallback: Ping reply
[00:00:38.013,000] &amp;lt;dbg&amp;gt; in3_ot: printIpv6Address: Mesh Local EID Address: fd97.6739.093e.0002.0000.0000.0808.0808
[00:00:38.019,622] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): Check TCP listener for pkt 0x2002f4b0 src port 443 dst port 37717 family 2
[00:00:38.019,653] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): [0x20010974] match found cb 0x18045 ud 0x200103c8 rank 0x3f
[00:00:38.019,989] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): SYN,ACK Seq=2596550350 Ack=3072386417 Len=0 [SYN_SENT Seq=3072386417 Ack=0]
[00:00:38.020,019] &amp;lt;dbg&amp;gt; net_tcp: tcp_options_check: (rx_q[0]): len=4
[00:00:38.020,050] &amp;lt;dbg&amp;gt; net_tcp: tcp_options_check: (rx_q[0]): opt: 2, opt_len: 4
[00:00:38.020,080] &amp;lt;dbg&amp;gt; net_tcp: tcp_options_check: (rx_q[0]): MSS=1412
[00:00:38.020,111] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): Lowering send window from 65535 to 1280
[00:00:38.020,141] &amp;lt;dbg&amp;gt; net_tcp: tcp_window_full: (rx_q[0]): conn: 0x20030100 window_full=0
[00:00:38.020,294] &amp;lt;dbg&amp;gt; net_tcp: tcp_send_timer_cancel: (rx_q[0]): SYN Seq=3072386416 Len=0
[00:00:38.020,599] &amp;lt;dbg&amp;gt; net_tcp: tcp_out_ext: (rx_q[0]): ACK Seq=3072386417 Ack=2596550351 Len=0
[00:00:38.020,812] &amp;lt;dbg&amp;gt; net_tcp: tcp_send_process_no_lock: (rx_q[0]): ACK Seq=3072386417 Ack=2596550351 Len=0 
[00:00:38.020,996] &amp;lt;dbg&amp;gt; net_tcp: tcp_send: (rx_q[0]): ACK Seq=3072386417 Ack=2596550351 Len=0
[00:00:38.021,087] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): SYN_SENT-&amp;gt;ESTABLISHED
[00:00:38.021,331] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_connect: (main): conn: 0x20030100, ret=0
[00:00:38.021,392] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_recv: (main): context: 0x200103c8, cb: 0x8e55, user_data: (nil)
[00:00:38.051,879] &amp;lt;err&amp;gt; http_client: Cannot connect to IPv6 remote (-22)
[00:00:38.051,910] &amp;lt;dbg&amp;gt; net_sock: z_impl_zsock_close: (main): close: ctx=0x200034b0, fd=0
[00:00:38.052,062] &amp;lt;dbg&amp;gt; net_sock: z_impl_zsock_close: (main): close: ctx=0x200103c8, fd=1
[00:00:38.052,093] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_recv: (main): context: 0x200103c8, cb: (nil), user_data: (nil)
[00:00:38.052,276] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_put: (main):  [ESTABLISHED Seq=3072386417 Ack=2596550351]
[00:00:38.052,307] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_put: (main): context 0x200103c8 CONNECTED
[00:00:38.052,337] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_put: (main): TCP connection in active close, not disposing yet (waiting 22753ms)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With the same code, the result is different for another server(eth-mainnet.g.alchemy.com)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:32.912,048] &amp;lt;dbg&amp;gt; in3_ot: pingResponseCallback: Ping reply
[00:00:32.912,048] &amp;lt;dbg&amp;gt; in3_ot: printIpv6Address: Mesh Local EID Address: fd97.6739.093e.0002.0000.0000.6812.2b47
[00:00:32.977,539] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): Check TCP listener for pkt 0x2002f4a0 src port 443 dst port 43175 family 2
[00:00:32.977,600] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): [0x20010974] match found cb 0x18045 ud 0x200103c8 rank 0x3f
[00:00:32.977,935] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): ACK Seq=2701949632 Ack=3965925004 Len=0 [ESTABLISHED Seq=3965924917 Ack=2701949632]
[00:00:32.977,966] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): Lowering send window from 64153 to 1280
[00:00:32.977,996] &amp;lt;dbg&amp;gt; net_tcp: tcp_window_full: (rx_q[0]): conn: 0x200300f0 window_full=0
[00:00:32.978,057] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): conn: 0x200300f0 len_acked=87
[00:00:32.978,118] &amp;lt;dbg&amp;gt; net_tcp: tcp_window_full: (rx_q[0]): conn: 0x200300f0 window_full=0
[00:00:32.978,149] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): conn: 0x200300f0 total=0, unacked_len=0, send_win=1280, mss=1280
[00:00:32.978,179] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): conn: 0x200300f0 send_data_timer=1, send_data_retries=0
[00:00:32.978,210] &amp;lt;dbg&amp;gt; net_tcp: tcp_unsent_len: (rx_q[0]): unsent_len=0
[00:00:32.978,271] &amp;lt;dbg&amp;gt; net_tcp: tcp_window_full: (rx_q[0]): conn: 0x200300f0 window_full=0
[00:00:33.576,904] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): Check TCP listener for pkt 0x2002f4a0 src port 443 dst port 43175 family 2
[00:00:33.576,934] &amp;lt;dbg&amp;gt; net_conn: net_conn_input: (rx_q[0]): [0x20010974] match found cb 0x18045 ud 0x200103c8 rank 0x3f
[00:00:33.577,301] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): ACK,PSH Seq=2701949632 Ack=3965925004 Len=7 [ESTABLISHED Seq=3965925004 Ack=2701949632]
[00:00:33.577,331] &amp;lt;dbg&amp;gt; net_tcp: tcp_in: (rx_q[0]): Lowering send window from 64153 to 1280
[00:00:33.577,362] &amp;lt;dbg&amp;gt; net_tcp: tcp_window_full: (rx_q[0]): conn: 0x200300f0 window_full=0
[00:00:33.577,697] &amp;lt;dbg&amp;gt; net_tcp: tcp_out_ext: (rx_q[0]): ACK Seq=3965925004 Ack=2701949639 Len=0
[00:00:33.577,911] &amp;lt;dbg&amp;gt; net_tcp: tcp_send_process_no_lock: (rx_q[0]): ACK Seq=3965925004 Ack=2701949639 Len=0 
[00:00:33.578,094] &amp;lt;dbg&amp;gt; net_tcp: tcp_send: (rx_q[0]): ACK Seq=3965925004 Ack=2701949639 Len=0
[00:00:33.578,216] &amp;lt;dbg&amp;gt; net_sock: zsock_received_cb: (rx_q[0]): ctx=0x200103c8, pkt=0x2002f4a0, st=0, user_data=(nil)
[00:00:33.578,552] &amp;lt;err&amp;gt; net_sock_tls: TLS handshake error: -7780
[00:00:33.579,437] &amp;lt;err&amp;gt; http_client: Cannot connect to IPv6 remote (-113)
[00:00:33.579,467] &amp;lt;dbg&amp;gt; net_sock: z_impl_zsock_close: (main): close: ctx=0x200034b0, fd=0
[00:00:33.580,322] &amp;lt;dbg&amp;gt; net_sock: z_impl_zsock_close: (main): close: ctx=0x200103c8, fd=1
[00:00:33.580,352] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_recv: (main): context: 0x200103c8, cb: (nil), user_data: (nil)
[00:00:33.580,535] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_put: (main):  [ESTABLISHED Seq=3965925004 Ack=2701949639]
[00:00:33.580,596] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_put: (main): context 0x200103c8 CONNECTED
[00:00:33.580,627] &amp;lt;dbg&amp;gt; net_tcp: net_tcp_put: (main): TCP connection in active close, not disposing yet (waiting 22753ms)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What do you think about this two different behaviour. Feel free to ask any missing points. I am really blocked because of this issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Vipin Das&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/409408?ContentTypeID=1</link><pubDate>Fri, 10 Feb 2023 16:29:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7ae91a1-88b4-4d1a-bcb3-04b23b833557</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Looks like your error is similar to &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/86632/openthread-and-mqtt-over-tls-is-single-program/363687"&gt;this thread&lt;/a&gt;. Can you check if the suggestions there help you resolve your issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/408903?ContentTypeID=1</link><pubDate>Wed, 08 Feb 2023 14:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:895cf732-070d-4c59-8db3-9e742380af51</guid><dc:creator>vipin das</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi J&amp;oslash;rgen,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I could solve the EINVAL(-22) error wrt to TLS socket connection.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But now I am seeing new error.&amp;nbsp;Could you please comment on the below error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:33.341,827] &amp;lt;err&amp;gt; net_sock_tls: TLS handshake error: -7780
[00:00:33.343,750] &amp;lt;err&amp;gt; http_client: Cannot connect to IPv6 remote (-113)
[00:00:33.343,780] &amp;lt;err&amp;gt; http_client: Setup socket Failed
[00:00:33.343,780] &amp;lt;err&amp;gt; http_client: Failed to connect to socket
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vipin Das&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/408392?ContentTypeID=1</link><pubDate>Mon, 06 Feb 2023 21:25:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34b6321a-3b57-4497-bcb5-d753fddd5834</guid><dc:creator>vipin das</dc:creator><description>&lt;p&gt;Hi J&amp;oslash;rgen,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t make any relevant modification to http_client to harm the working of that (I believe).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static int establish_connection(sa_family_t family, const char* ipv6_addr, int port, int* sock, struct sockaddr* addr, socklen_t addr_len) {
  const char* family_str = family == AF_INET ? &amp;quot;IPv4&amp;quot; : &amp;quot;IPv6&amp;quot;;
  int         ret        = 0;

  memset(addr, 0, addr_len);

  if (family == AF_INET) {
    net_sin(addr)-&amp;gt;sin_family = AF_INET;
    net_sin(addr)-&amp;gt;sin_port   = htons(port);
    inet_pton(family, ipv6_addr, &amp;amp;net_sin(addr)-&amp;gt;sin_addr);
  }
  else {
    net_sin6(addr)-&amp;gt;sin6_family = AF_INET6;
    net_sin6(addr)-&amp;gt;sin6_port   = htons(port);
    inet_pton(AF_INET6, ipv6_addr, &amp;amp;net_sin6(addr)-&amp;gt;sin6_addr);
    LOG_DBG(&amp;quot;Server address: %s &amp;quot;, ipv6_addr);
  }

#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
  sec_tag_t sec_tag_list[] = {CA_CERTIFICATE_TAG};

  *sock = socket(family, SOCK_STREAM, IPPROTO_TLS_1_2);
  if (*sock &amp;gt;= 0) {
    ret = setsockopt(*sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_list));
    if (ret &amp;lt; 0) {
      LOG_ERR(&amp;quot;Failed to set %s secure option (%d)&amp;quot;, family_str, -errno);
      ret = -errno;
    }

    ret = setsockopt(*sock, SOL_TLS, TLS_HOSTNAME, TLS_PEER_HOSTNAME, sizeof(TLS_PEER_HOSTNAME));
    if (ret &amp;lt; 0) {
      LOG_ERR(&amp;quot;Failed to set %s TLS_HOSTNAME &amp;quot;
              &amp;quot;option (%d)&amp;quot;,
              family_str, -errno);
      ret = -errno;
    }
  }
#else
  *sock = socket(family, SOCK_STREAM, IPPROTO_TCP);
#endif

  if (*sock &amp;lt; 0) {
    LOG_ERR(&amp;quot;Failed to create %s HTTP socket (%d)&amp;quot;, family_str, -errno);
  }

  ret = connect(*sock, addr, addr_len);
  if (ret &amp;lt; 0) {
    LOG_ERR(&amp;quot;Cannot connect to %s remote (%d)&amp;quot;, family == AF_INET ? &amp;quot;IPv4&amp;quot; : &amp;quot;IPv6&amp;quot;, -errno);
    ret = -errno;
  }

  return ret;
}

/**
 *
 */
static void server_response_cb(struct http_response* rsp, enum http_final_call final_data, void* user_data) {
  if (final_data == HTTP_DATA_MORE) {
    LOG_DBG(&amp;quot;Partial data received (%zd bytes)&amp;quot;, rsp-&amp;gt;data_len);
  }
  else if (final_data == HTTP_DATA_FINAL) {
    LOG_DBG(&amp;quot;All the data received (%zd bytes)&amp;quot;, rsp-&amp;gt;data_len);
  }

  LOG_DBG(&amp;quot;Response to %s&amp;quot;, (const char*) user_data);
  LOG_DBG(&amp;quot;Response status %s&amp;quot;, rsp-&amp;gt;http_status);
}

/**
 *
 */
static int setup_socket_connection(sa_family_t family, const char* ipv6_addr, int port,
                                   int* sock, struct sockaddr* addr, socklen_t addr_len) {
  int ret = 0;

  ret = establish_connection(family, ipv6_addr, port, sock, addr, addr_len);
  if (ret &amp;lt; 0 || *sock &amp;lt; 0) {
    LOG_ERR(&amp;quot;Setup socket connection failed&amp;quot;);
    return -1;
  }
  return ret;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any critical warnings.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ncs/zephyr/include/zephyr/zephyr.h:13:2: warning: #warning &amp;quot;&amp;lt;zephyr/zephyr.h&amp;gt; is deprecated, include &amp;lt;zephyr/kernel.h&amp;gt; instead&amp;quot; [-Wcpp]
   13 | #warning &amp;quot;&amp;lt;zephyr/zephyr.h&amp;gt; is deprecated, include &amp;lt;zephyr/kernel.h&amp;gt; instead&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have tried to setup sniffer but due to some reasons my nrf-sniffer interface is not detected in the Wireshark tool. I tried multiple steps and different version but couldn&amp;#39;t succeed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But by just disabling CONFIG_NET_SOCKETS_SOCKOPT_TLS, the same code works for TCP socket connection and able to send and receive RPC message to our remote server.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Vipin Das&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TLS Socket connection request return with error number -22(EINVAL)</title><link>https://devzone.nordicsemi.com/thread/408352?ContentTypeID=1</link><pubDate>Mon, 06 Feb 2023 15:27:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ed7c324-7daf-49bc-a86b-0679f3167d04</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you post the changes you have made to the sample? As far as I can see, the original sample does not implement OpenThread support.&lt;/p&gt;
&lt;p&gt;Do you get any warnings when building the application?&lt;/p&gt;
&lt;p&gt;Have you done a sniffer trace, to see if there is any error from the on-air traffic?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>