[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] DHCP, switch to static IP if no answer

From: Walter Saegesser
Subject: [lwip-users] DHCP, switch to static IP if no answer
Date: Wed, 22 Jun 2011 14:36:42 +0200

In the current project DHCP is enabled by default, assuming that in most cases there is a DHCP server around.

But what, if not.

1.       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).

2.       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 correct code?

            dhcp_stop ( &mNetIf );
.flags &= ~NETIF_FLAG_DHCP;
netif_set_addr ( &mNetIf, &xIpAddr, &xNetMask, &xGwAddr );


Thanks a lot.



Walter Saegesser
Dipl.-Ing. (FH)

R&D - Software
Business Unit IMS – Line
of Business Solar Inverter
Delta Renewable Energy Systems (Switzerland) AG
Burgerfeldstrasse 19, CH-8730 Uznach SG, Switzerland
TEL:       +41 (0)55 246-4140
FAX:      +41 (0)55 246-4116


This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain
confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
[Delta Energy Systems]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]