[mailto:address@hidden On Behalf
Of Walter Saegesser
Sent: Wednesday, June 22, 2011 8:37 AM
Subject: [lwip-users] DHCP, switch to static IP if no answer
In the current project DHCP is enabled by default, assuming
that in most cases there is a DHCP server around.
But what, if not.
How can I realize there is no answer from a DHCP
server? Do I have to wait for some time, say a minute, and then check whether
the netif IP address is still 0? Or is there a better and more convenient way?
(I’m working with netconn API).
Assuming I have detected the failure, what do I have to
do to switch to a static default IP (and GW, and mask)? Would this be the
mNetIf.flags &= ~NETIF_FLAG_DHCP;
netif_set_addr ( &mNetIf,
&xIpAddr, &xNetMask, &xGwAddr );
Thanks a lot.