Цитата(vadon @ Jul 25 2018, 21:23)
Почему бы не использовать готовую функцию:
Код
/**
* @ingroup udp_raw
* Bind an UDP PCB to a specific netif.
* After calling this function, all packets received via this PCB
* are guaranteed to have come in via the specified netif, and all
* outgoing packets will go out via the specified netif.
*
* @param pcb UDP PCB to be bound.
* @param netif netif to bind udp pcb to. Can be NULL.
*
* @see udp_disconnect()
*/
void
udp_bind_netif(struct udp_pcb *pcb, const struct netif *netif)
{
LWIP_ASSERT_CORE_LOCKED();
if (netif != NULL) {
pcb->netif_idx = netif_get_index(netif);
} else {
pcb->netif_idx = NETIF_NO_INDEX;
}
}
я использую сокеты , а не pcb
и мой вариант работает
неизвестно как это будет работать если несколько интерфейсов останутся в одной сетке