MQTT Client bind IP/interface

noiseman
Posts: 2
Joined: Thu Dec 06, 2018 12:33 pm

MQTT Client bind IP/interface

Postby noiseman » Thu Jun 06, 2019 6:21 pm

Hi!
Does anybody know if there any way to bind local IP/interface for mqtt client connection?

Now the logic of my app is the following:
1. Connecting Wifi STA
2. Connecting ETH
3. ETH set as default IF with the following function:

esp_err_t setDefaultIf(tcpip_adapter_if_t tcpip_if)
{
struct netif *_netif;
esp_err_t ret = tcpip_adapter_get_netif(tcpip_if, (void **)&_netif);
if (ret != ESP_OK)
{
return ret;
}
netif_set_default(_netif);
return ESP_OK;
}
...
setDefaultIf(TCPIP_ADAPTER_IF_ETH);
...

4. Connect MQTT client to server

I expects that mqtt client must bind default IF as a local IP/interface, but anyway if STA IF is up MQTT client connects to server via STA IP/interface. If there any way to tell MQTT client to use specific (default) interface?

Thanks in advance.

Who is online

Users browsing this forum: Ask Jeeves [Bot], Majestic-12 [Bot], noweare and 201 guests