Ejemplo n.º 1
0
 /// <summary>Resolves an IP address to an <see cref="T:System.Net.IPHostEntry" /> instance.</summary>
 /// <returns>An <see cref="T:System.Net.IPHostEntry" /> instance that contains address information about the host specified in <paramref name="address" />.</returns>
 /// <param name="address">An IP address.</param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="address" /> is null. </exception>
 /// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving <paramref name="address" />. </exception>
 /// <exception cref="T:System.ArgumentException">
 ///   <paramref name="address" /> is an invalid IP address.</exception>
 public static IPHostEntry GetHostEntry(IPAddress address)
 {
     if (address == null)
     {
         throw new ArgumentNullException("address");
     }
     return(Dns.GetHostByAddressFromString(address.ToString(), false));
 }
Ejemplo n.º 2
0
 public static IPHostEntry GetHostByAddress(string address)
 {
     if (address == null)
     {
         throw new ArgumentNullException("address");
     }
     return(Dns.GetHostByAddressFromString(address, true));
 }