I am scanning for IPs on my local network, and one of the pieces of information I wish to receive when an IP is found is whether that IP is static or dynamic. So far, the closest question to mine that I have found only addresses checking your own machine. Here is my function:
private bool isDynamic()
{
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
int currentSocketIndex = (new IPPacketInformation()).Interface;
bool isDynamic = adapters[currentSocketIndex].GetIPProperties().GetIPv4Properties().IsDhcpEnabled;
return isDynamic;
}
I would like to modify this so that it can take an IP address, connect to the device that the IP belongs to (if it exists and does not block the connection), and determine whether that machine's IP is static/dynamic. At the moment, my function only checks my machine.
Could anyone point me in the right direction? I can't find references for doing something like this, but I doubt that it's impossible.