/// <summary> /// Connects to a DHCP server /// </summary> /// <param name="HostNameOrAddress"></param> public static DhcpServer Connect(string HostNameOrAddress) { if (string.IsNullOrWhiteSpace(HostNameOrAddress)) { throw new ArgumentNullException("HostNameOrAddress"); } var dnsEntry = Dns.GetHostEntry(HostNameOrAddress); var dnsAddress = dnsEntry.AddressList.Where(a => a.AddressFamily == AddressFamily.InterNetwork).FirstOrDefault(); if (dnsAddress == null) { throw new NotSupportedException("Unable to resolve an IPv4 address for the DHCP Server"); } var address = DHCP_IP_ADDRESS.FromIPAddress(dnsAddress); return(new DhcpServer(address, dnsEntry.HostName)); }
public bool Contains(IPAddress IpAddress) { return(Contains(DHCP_IP_ADDRESS.FromIPAddress(IpAddress))); }