<?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>Multiple network interfaces, socket problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81091/multiple-network-interfaces-socket-problem</link><description>Hi, 
 with a custom hardware, I&amp;#39;m using a NRF9160 with a ESP8266 chip over uart with following prj.conf and board overlay: 
 
 
 I was trying to open a socket (that uses the Wifi chip) and connect to it: 
 
 
 I tried to debug it, and I noticed that the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 Oct 2021 06:23:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81091/multiple-network-interfaces-socket-problem" /><item><title>RE: Multiple network interfaces, socket problem</title><link>https://devzone.nordicsemi.com/thread/336324?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2021 06:23:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32653126-d4ba-4660-9f82-854ac8ed3cc7</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p&gt;Hello Joris,&lt;/p&gt;
[quote user=""]I was trying to open a socket (that uses the Wifi chip) and connect to it:[/quote]
&lt;p&gt;&lt;span lang="en-GB"&gt;This is a tricky one, actually. In general, if nRF91 socket offloading is enabled it takes over all of the &lt;/span&gt;&lt;span lang="en-GB"&gt;socket()&lt;/span&gt;&lt;span lang="en-GB"&gt; calls with default parameters.&lt;/span&gt;&lt;/p&gt;
[quote user=""]I tried to debug it, and I noticed that the wrong network interface is chosen, with the consequence that the offload functions are not called. I guess that it&amp;#39;s a configuration issue, but until now no luck to find it...[/quote]
&lt;p&gt;&lt;span lang="en-GB"&gt;We have &lt;/span&gt;&lt;span lang="en-GB"&gt;recently&lt;/span&gt;&lt;span lang="en-GB"&gt; introduced a new flag &lt;/span&gt;&lt;span lang="en-GB"&gt;on master branch,&lt;/span&gt;&lt;span lang="en-GB"&gt; &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/include/net/socket_ncs.h#L47"&gt;SOCK_NATIVE&lt;/a&gt;&lt;/span&gt;&lt;span&gt;&lt;span lang="en-GB"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span lang="en-GB"&gt;It can&lt;/span&gt;&lt;/span&gt;&lt;span lang="en-GB"&gt; be used when creating a socket to indicate that the intention is to create a socket for the native networking stack &lt;/span&gt;&lt;span lang="en-GB"&gt;and&lt;/span&gt;&lt;span lang="en-GB"&gt; not &lt;/span&gt;&lt;span lang="en-GB"&gt;the&lt;/span&gt;&lt;span lang="en-GB"&gt; nRF91 offloaded one. &lt;/span&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;You could try to create a socket like this:&lt;/p&gt;
&lt;p lang="en-GB"&gt;&lt;pre class="ui-code" data-mode="text"&gt;socket(AF_INET, SOCK_STREAM | SOCK_NATIVE, IPPROTO_TCP)&lt;/pre&gt;&lt;/p&gt;
&lt;p lang="en-GB"&gt;The socket call should be redirected to the native stack instead, since&amp;nbsp;the&amp;nbsp;&lt;span&gt;ESP8266&lt;/span&gt; is using a different offload mechanism (&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.0/kconfig/CONFIG_NET_OFFLOAD.html#std-kconfig-CONFIG_NET_OFFLOAD"&gt;NET_OFFLOAD&lt;/a&gt;) which falls under &amp;quot;native stack&amp;quot;. We have not tested with such a setup though, so we can not give a 100% guarantee that it works.&lt;/p&gt;
&lt;p lang="en-GB"&gt;Regards,&lt;/p&gt;
&lt;p lang="en-GB"&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>