I’m having a bit of a problem with registering ChipworkX to LAN. The code I’m using is:
NetworkInterface netif = NetworkInterface.GetAllNetworkInterfaces(); if (netif.IsDhcpEnabled) netif.RenewDhcpLease(); else netif.EnableDhcp();
This works fine when there is a DHCP server on the network. The device gets an IP address and everything runs ok. When there is no DHCP server, however, everything freezes upon RenewDhcpLease call. The method is called from a separate thread (set to lowest priority). This doesn’t seem to make any difference, however, the device is unresponsive for 1-2 minutes before throwing an exception. Can you give me a tip how to detect if there is a DHCP server running on the network, or how to prevent that RenewDhcpLease method from blocking the whole device. Thanks!