<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Socket.bind ignores IP]]></title><description><![CDATA[<p dir="auto">I would like to use LTE for transmitting MQTT messages to TTN.<br />
The WLAN is used in AP mode to locally serve HTML pages to a tablet for configuration and showing status of the device.</p>
<p dir="auto">The LTE class has no function to get the IP address.<br />
First I create LTE, attach, check and connect.<br />
To access TTN via MQTT a socket is opened.<br />
It's opened on the first NIC found.<br />
Works fine if only LTE is started.</p>
<p dir="auto">Now when I start WLAN in AP mode (mode does'nt matter), WLAN registers its NIC, that means it appends to the NIC list.<br />
From WLAN.ifconfig I get the IP 0:0:0:0 in AP mode.<br />
Opening a socket links to the LTE NIC, not the WLAN NIC, although providing the IP address to bind to.</p>
<p dir="auto">Having a look at the source code in <em>modnetwork.c</em>, function <em>mod_network_find_nic</em> I noticed, that IP address is ignored and just the first NIC with AF_INET is returned.</p>
<p dir="auto">If two NIC's with AF_INET are registered, it's not possible to open a socket on the second.<br />
For selecting the correct NIC the IP address of the LTE is necessary, please add such a function and enhance the code in <em>mod_network_find_nic</em>.<br />
Thanks</p>
]]></description><link>https://forum.pycom.io/topic/3030/socket-bind-ignores-ip</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Apr 2026 13:32:03 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/3030.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Apr 2018 13:30:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Socket.bind ignores IP on Thu, 12 Apr 2018 13:30:20 GMT]]></title><description><![CDATA[<p dir="auto">I would like to use LTE for transmitting MQTT messages to TTN.<br />
The WLAN is used in AP mode to locally serve HTML pages to a tablet for configuration and showing status of the device.</p>
<p dir="auto">The LTE class has no function to get the IP address.<br />
First I create LTE, attach, check and connect.<br />
To access TTN via MQTT a socket is opened.<br />
It's opened on the first NIC found.<br />
Works fine if only LTE is started.</p>
<p dir="auto">Now when I start WLAN in AP mode (mode does'nt matter), WLAN registers its NIC, that means it appends to the NIC list.<br />
From WLAN.ifconfig I get the IP 0:0:0:0 in AP mode.<br />
Opening a socket links to the LTE NIC, not the WLAN NIC, although providing the IP address to bind to.</p>
<p dir="auto">Having a look at the source code in <em>modnetwork.c</em>, function <em>mod_network_find_nic</em> I noticed, that IP address is ignored and just the first NIC with AF_INET is returned.</p>
<p dir="auto">If two NIC's with AF_INET are registered, it's not possible to open a socket on the second.<br />
For selecting the correct NIC the IP address of the LTE is necessary, please add such a function and enhance the code in <em>mod_network_find_nic</em>.<br />
Thanks</p>
]]></description><link>https://forum.pycom.io/post/18403</link><guid isPermaLink="true">https://forum.pycom.io/post/18403</guid><dc:creator><![CDATA[DanielA]]></dc:creator><pubDate>Thu, 12 Apr 2018 13:30:20 GMT</pubDate></item></channel></rss>