我正在使用以下代码从我的网络接口之一获取 DHCP 服务器地址:
System.Net.NetworkInformation.NetworkInterface networkInterface;
// ... get one of the network interfaces
var properties = networkInterface.GetIPProperties();
var addresses = properties.DhcpServerAddresses;
我的网络接口设置为固定地址(不是由 DHCP 分配的),我从该代码中获得一个地址,即 255.255.255.255。谁能告诉我为什么?以及如何检查网络接口是否使用 DHCP 或固定地址。