public sealed class Dns
|
The host information from the DNS query is returned in an instance of the IPHostEntry class. If the specified host has more than one entry in the DNS database, IPHostEntry contains multiple IP addresses and aliases.
IPHostEntry hostInfo = Dns.GetHostByName("www.contoso.com");
BeginGetHostByName | Begins an asynchronous request for IPHostEntry information about the specified DNS host name. |
BeginResolve | Begins an asynchronous request to resolve a DNS host name or IP address in dotted-quad notation to an IPAddress instance. |
EndGetHostByName | Ends an asynchronous request for DNS information. |
EndResolve | Ends an asynchronous request for DNS information. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetHostByAddress | Overloaded:GetHostByAddress(IPAddress address) Creates an IPHostEntry instance from a specified IPAddress instance. |
GetHostByAddress | Overloaded:GetHostByAddress(string address) Creates an IPHostEntry instance from an address in dotted-quad notation ("198.162.1.2"). |
GetHostByName | Gets the DNS information for the specified DNS host name. |
GetHostName | Gets the host name of the local computer. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
Resolve | Resolves a DNS host name or IP address in dotted-quad notation to an IPHostEntry instance. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public static IAsyncResult BeginGetHostByName( |
hostName
requestCallback
stateObject
public static IAsyncResult BeginResolve( |
hostName
requestCallback
stateObject
public static IPHostEntry EndGetHostByName( |
asyncResult
Exception Type | Condition |
---|---|
ArgumentNullException | asyncResult is null. |
public static IPHostEntry EndResolve( |
asyncResult
Exception Type | Condition |
---|---|
ArgumentNullException | asyncResult is null. |
~Dns(); |
public virtual int GetHashCode(); |
public static IPHostEntry GetHostByAddress( |
address
Exception Type | Condition |
---|---|
ArgumentNullException | address is null. |
SocketException | An error is encountered when resolving address. |
public static IPHostEntry GetHostByAddress( |
address
Exception Type | Condition |
---|---|
ArgumentNullException | address is null. |
SocketException | An error is encountered when resolving address. |
FormatException | address is not a valid IP address. |
public static IPHostEntry GetHostByName( |
hostName
Exception Type | Condition |
---|---|
ArgumentNullException | hostName is null. |
SocketException | An error is encountered resolving hostName. |
For asychronous access to DNS information, use the Dns.BeginGetHostByName and Dns.EndGetHostByName methods.
public static string GetHostName(); |
Exception Type | Condition |
---|---|
SocketException | An error is encountered when resolving the local host name. |
public Type GetType(); |
protected object MemberwiseClone(); |
public static IPHostEntry Resolve( |
hostName
Exception Type | Condition |
---|---|
ArgumentNullException | hostName is null. |
SocketException | An error is encountered when resoloving hostName. |
When hostName is a DNS-style host name associated with multiple IP addresses, only the first IP address that resolves to that host name is returned.
public virtual string ToString(); |