System.Net.IPHostEntry Class

Provides a container class for Internet host address information.

See Also: IPHostEntry Members


public class IPHostEntry


The System.Net.IPHostEntry class associates a Domain Name System (DNS) host name with an array of aliases and an array of matching IP addresses.

The System.Net.IPHostEntry class is used as a helper class with the System.Net.Dns class.

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.


The following example queries the DNS database for information on the host "" and displays the information in the returned System.Net.IPHostEntry instance.

C# Example

using System;
using System.Net;

public class IPHostEntryTest {
 public static void Main() {
 IPHostEntry hostInfo = Dns.GetHostByName("");

 string[] aliases = hostInfo.Aliases;
 IPAddress[] addresses = hostInfo.AddressList;
 Console.WriteLine("The host name is: {0}", hostInfo.HostName);

 for(int x = 0; x < aliases.Length; x++)
 Console.WriteLine("Alias {0} == {1}", aliases[x], addresses[x]);

The output is

The host name is:
Alias ==


Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.x.x, 1.0.5000.0,,