Hi,

i am using lwIP 2.1.2 on an embedded device with a WiFi connection in NO_SYS mode using DHCP and the raw API. I need my application to initiate a TCP connection immediately after a completed DHCP negotiation, i.e. as soon as possible. This also needs to happen when the link is disconnected and reconnected, after a DHCP reboot. I am using the status callback (netif_set_status_callback) and check for a successful DHCP address assignment like this:

void statusChange (struct netif* nif) {
    if (dhcp_supplied_address (nif) && netif_is_link_up(nif)) { // Initiate TCP connection ...

When I restart my WiFi access point, the link is reconnected as desired, and lwIP performs a DHCP reboot and receives the same address as before. Unfortunately, in this case, the status callback is never called after a dhcp reboot. I think this is because in netif_do_set_ipaddr, the "NETIF_STATUS_CALLBACK" only happens when the address is actually different.

So, how do I know when the link is ready for TCP connections after a WiFi re-association and DHCP reboot?

The WiFi driver calls netif_set_link_down / netif_set_link_up upon WiFi (de)association. After bootup, I call netif_set_up and dhcp_start once.

Thanks & Greetings,
Niklas


_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to