# Ifconfig timeout

**URL:** <https://forums.digi.com/t/ifconfig-timeout/10662>\
**Category:** Rabbit\
**Created:** [December 5, 2011, 11:17am UTC](https://forums.digi.com/t/ifconfig-timeout/10662 "2011-12-05T11:17:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![torerik](https://avatars.discourse-cdn.com/v4/letter/t/ecccb3/32.png) [@torerik](https://forums.digi.com/u/torerik)\
**Post date:** [December 5, 2011, 11:17am UTC](https://forums.digi.com/t/ifconfig-timeout/10662/1 "2011-12-05T11:17:01Z")

</div>

Hi all,

I am building an application which can be setup with either DHCP or static IP through a web UI.

The changing from DHCP to static IP, and vice versa, is done in a function called toggle\_dhcp().  
One of the first lines in the method is “ifconfig(IF\_DEFAULT, IFG\_DHCP, IFS\_END)” to check if DHCP is currently being used.  
However, this call consistently times out each time.

Is this there something wrong with this use of ifconfig?

Any help is appreciated.

Regards,  
Tor Erik

---

<div class="post-metadata">

**Author:** ![petermcs](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@petermcs](https://forums.digi.com/u/petermcs)\
**Post date:** [December 5, 2011, 1:36pm UTC](https://forums.digi.com/t/ifconfig-timeout/10662/2 "2011-12-05T13:36:30Z")

</div>

When using IFG\_x you need an additional argument which is the pointer to where to store the result. For your example you would use:

bool bDHCP;  
ifconfig(IF\_DEFAULT, IFG\_DHCP, &bDHCP, IFS\_END);

This fetches the current DHCP state into bDHCP.

Regards,  
Peter
