mscorlib(4.0.0.0) API with additions
System.Net.Dns Class Reference

Provides simple domain name resolution functionality. More...

Static Public Member Functions

static IPHostEntry GetHostByName (string hostName)
 Gets the DNS information for the specified DNS host name. More...
 
static IPHostEntry GetHostByAddress (string address)
 Creates an T:System.Net.IPHostEntry instance from an IP address. More...
 
static IPHostEntry GetHostByAddress (IPAddress address)
 Creates an T:System.Net.IPHostEntry instance from the specified T:System.Net.IPAddress. More...
 
static string GetHostName ()
 Gets the host name of the local computer. More...
 
static IPHostEntry Resolve (string hostName)
 Resolves a DNS host name or IP address to an T:System.Net.IPHostEntry instance. More...
 
static IAsyncResult BeginGetHostByName (string hostName, AsyncCallback requestCallback, object stateObject)
 Begins an asynchronous request for T:System.Net.IPHostEntry information about the specified DNS host name. More...
 
static IPHostEntry EndGetHostByName (IAsyncResult asyncResult)
 Ends an asynchronous request for DNS information. More...
 
static IPHostEntry GetHostEntry (string hostNameOrAddress)
 Resolves a host name or IP address to an T:System.Net.IPHostEntry instance. More...
 
static IPHostEntry GetHostEntry (IPAddress address)
 Resolves an IP address to an T:System.Net.IPHostEntry instance. More...
 
static IPAddress [] GetHostAddresses (string hostNameOrAddress)
 Returns the Internet Protocol (IP) addresses for the specified host. More...
 
static IAsyncResult BeginGetHostEntry (string hostNameOrAddress, AsyncCallback requestCallback, object stateObject)
 Asynchronously resolves a host name or IP address to an T:System.Net.IPHostEntry instance. More...
 
static IAsyncResult BeginGetHostEntry (IPAddress address, AsyncCallback requestCallback, object stateObject)
 Asynchronously resolves an IP address to an T:System.Net.IPHostEntry instance. More...
 
static IPHostEntry EndGetHostEntry (IAsyncResult asyncResult)
 Ends an asynchronous request for DNS information. More...
 
static IAsyncResult BeginGetHostAddresses (string hostNameOrAddress, AsyncCallback requestCallback, object state)
 Asynchronously returns the Internet Protocol (IP) addresses for the specified host. More...
 
static IPAddress [] EndGetHostAddresses (IAsyncResult asyncResult)
 Ends an asynchronous request for DNS information. More...
 
static IAsyncResult BeginResolve (string hostName, AsyncCallback requestCallback, object stateObject)
 Begins an asynchronous request to resolve a DNS host name or IP address to an T:System.Net.IPAddress instance. More...
 
static IPHostEntry EndResolve (IAsyncResult asyncResult)
 Ends an asynchronous request for DNS information. More...
 
static Task< IPAddress[]> GetHostAddressesAsync (string hostNameOrAddress)
 Returns the Internet Protocol (IP) addresses for the specified host as an asynchronous operation. More...
 
static Task< IPHostEntryGetHostEntryAsync (IPAddress address)
 Resolves an IP address to an T:System.Net.IPHostEntry instance as an asynchronous operation. More...
 
static Task< IPHostEntryGetHostEntryAsync (string hostNameOrAddress)
 Resolves a host name or IP address to an T:System.Net.IPHostEntry instance as an asynchronous operation. More...
 

Detailed Description

Provides simple domain name resolution functionality.

Definition at line 13 of file Dns.cs.

Member Function Documentation

◆ BeginGetHostAddresses()

static IAsyncResult System.Net.Dns.BeginGetHostAddresses ( string  hostNameOrAddress,
AsyncCallback  requestCallback,
object  state 
)
static

Asynchronously returns the Internet Protocol (IP) addresses for the specified host.

Parameters
hostNameOrAddressThe host name or IP address to resolve.
requestCallbackAn T:System.AsyncCallback delegate that references the method to invoke when the operation is complete.
stateA user-defined object that contains information about the operation. This object is passed to the requestCallback delegate when the operation is complete.
Returns
An T:System.IAsyncResult instance that references the asynchronous request.
Exceptions
T:System.ArgumentNullExceptionhostNameOrAddress is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostNameOrAddress is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving hostNameOrAddress .
T:System.ArgumentExceptionhostNameOrAddress is an invalid IP address.

Definition at line 722 of file Dns.cs.

◆ BeginGetHostByName()

static IAsyncResult System.Net.Dns.BeginGetHostByName ( string  hostName,
AsyncCallback  requestCallback,
object  stateObject 
)
static

Begins an asynchronous request for T:System.Net.IPHostEntry information about the specified DNS host name.

Parameters
hostNameThe DNS name of the host.
requestCallbackAn T:System.AsyncCallback delegate that references the method to invoke when the operation is complete.
stateObjectA user-defined object that contains information about the operation. This object is passed to the requestCallback delegate when the operation is complete.
Returns
An T:System.IAsyncResult instance that references the asynchronous request.
Exceptions
T:System.ArgumentNullExceptionhostName is null.
T:System.Net.Sockets.SocketExceptionAn error was encountered executing the DNS query.

Definition at line 494 of file Dns.cs.

◆ BeginGetHostEntry() [1/2]

static IAsyncResult System.Net.Dns.BeginGetHostEntry ( string  hostNameOrAddress,
AsyncCallback  requestCallback,
object  stateObject 
)
static

Asynchronously resolves a host name or IP address to an T:System.Net.IPHostEntry instance.

Parameters
hostNameOrAddressThe host name or IP address to resolve.
requestCallbackAn T:System.AsyncCallback delegate that references the method to invoke when the operation is complete.
stateObjectA user-defined object that contains information about the operation. This object is passed to the requestCallback delegate when the operation is complete.
Returns
An T:System.IAsyncResult instance that references the asynchronous request.
Exceptions
T:System.ArgumentNullExceptionhostNameOrAddress is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostNameOrAddress is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving hostNameOrAddress .
T:System.ArgumentExceptionhostNameOrAddress is an invalid IP address.

Definition at line 652 of file Dns.cs.

◆ BeginGetHostEntry() [2/2]

static IAsyncResult System.Net.Dns.BeginGetHostEntry ( IPAddress  address,
AsyncCallback  requestCallback,
object  stateObject 
)
static

Asynchronously resolves an IP address to an T:System.Net.IPHostEntry instance.

Parameters
addressThe IP address to resolve.
requestCallbackAn T:System.AsyncCallback delegate that references the method to invoke when the operation is complete.
stateObjectA user-defined object that contains information about the operation. This object is passed to the requestCallback delegate when the operation is complete.
Returns
An T:System.IAsyncResult instance that references the asynchronous request.
Exceptions
T:System.ArgumentNullExceptionaddress is null.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving address .
T:System.ArgumentExceptionaddress is an invalid IP address.

Definition at line 677 of file Dns.cs.

◆ BeginResolve()

static IAsyncResult System.Net.Dns.BeginResolve ( string  hostName,
AsyncCallback  requestCallback,
object  stateObject 
)
static

Begins an asynchronous request to resolve a DNS host name or IP address to an T:System.Net.IPAddress instance.

Parameters
hostNameThe DNS name of the host.
requestCallbackAn T:System.AsyncCallback delegate that references the method to invoke when the operation is complete.
stateObjectA user-defined object that contains information about the operation. This object is passed to the requestCallback delegate when the operation is complete.
Returns
An T:System.IAsyncResult instance that references the asynchronous request.
Exceptions
T:System.ArgumentNullExceptionhostName is null.
T:System.Net.Sockets.SocketExceptionThe caller does not have permission to access DNS information.

Definition at line 777 of file Dns.cs.

◆ EndGetHostAddresses()

static IPAddress [] System.Net.Dns.EndGetHostAddresses ( IAsyncResult  asyncResult)
static

Ends an asynchronous request for DNS information.

Parameters
asyncResultAn T:System.IAsyncResult instance returned by a call to the M:System.Net.Dns.BeginGetHostAddresses(System.String,System.AsyncCallback,System.Object) method.
Returns
An array of type T:System.Net.IPAddress that holds the IP addresses for the host specified by the hostNameOrAddress parameter of M:System.Net.Dns.BeginGetHostAddresses(System.String,System.AsyncCallback,System.Object).

Definition at line 739 of file Dns.cs.

◆ EndGetHostByName()

static IPHostEntry System.Net.Dns.EndGetHostByName ( IAsyncResult  asyncResult)
static

Ends an asynchronous request for DNS information.

Parameters
asyncResultAn T:System.IAsyncResult instance that is returned by a call to the M:System.Net.Dns.BeginGetHostByName(System.String,System.AsyncCallback,System.Object) method.
Returns
An T:System.Net.IPHostEntry object that contains DNS information about a host.
Exceptions
T:System.ArgumentNullExceptionasyncResult is null.

Definition at line 514 of file Dns.cs.

◆ EndGetHostEntry()

static IPHostEntry System.Net.Dns.EndGetHostEntry ( IAsyncResult  asyncResult)
static

Ends an asynchronous request for DNS information.

Parameters
asyncResultAn T:System.IAsyncResult instance returned by a call to an Overload:System.Net.Dns.BeginGetHostEntry method.
Returns
An T:System.Net.IPHostEntry instance that contains address information about the host.
Exceptions
T:System.ArgumentNullExceptionasyncResult is null.

Definition at line 696 of file Dns.cs.

◆ EndResolve()

static IPHostEntry System.Net.Dns.EndResolve ( IAsyncResult  asyncResult)
static

Ends an asynchronous request for DNS information.

Parameters
asyncResultAn T:System.IAsyncResult instance that is returned by a call to the M:System.Net.Dns.BeginResolve(System.String,System.AsyncCallback,System.Object) method.
Returns
An T:System.Net.IPHostEntry object that contains DNS information about a host.
Exceptions
T:System.ArgumentNullExceptionasyncResult is null.

Definition at line 797 of file Dns.cs.

◆ GetHostAddresses()

static IPAddress [] System.Net.Dns.GetHostAddresses ( string  hostNameOrAddress)
static

Returns the Internet Protocol (IP) addresses for the specified host.

Parameters
hostNameOrAddressThe host name or IP address to resolve.
Returns
An array of type T:System.Net.IPAddress that holds the IP addresses for the host that is specified by the hostNameOrAddress parameter.
Exceptions
T:System.ArgumentNullExceptionhostNameOrAddress is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostNameOrAddress is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving hostNameOrAddress .
T:System.ArgumentExceptionhostNameOrAddress is an invalid IP address.

Definition at line 606 of file Dns.cs.

◆ GetHostAddressesAsync()

static Task<IPAddress[]> System.Net.Dns.GetHostAddressesAsync ( string  hostNameOrAddress)
static

Returns the Internet Protocol (IP) addresses for the specified host as an asynchronous operation.

Parameters
hostNameOrAddressThe host name or IP address to resolve.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns an array of type T:System.Net.IPAddress that holds the IP addresses for the host that is specified by the hostNameOrAddress parameter.
Exceptions
T:System.ArgumentNullExceptionhostNameOrAddress is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostNameOrAddress is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving hostNameOrAddress .
T:System.ArgumentExceptionhostNameOrAddress is an invalid IP address.

Definition at line 838 of file Dns.cs.

◆ GetHostByAddress() [1/2]

static IPHostEntry System.Net.Dns.GetHostByAddress ( string  address)
static

Creates an T:System.Net.IPHostEntry instance from an IP address.

Parameters
addressAn IP address.
Returns
An T:System.Net.IPHostEntry instance.
Exceptions
T:System.ArgumentNullExceptionaddress is null.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving address .
T:System.FormatExceptionaddress is not a valid IP address.

Definition at line 158 of file Dns.cs.

◆ GetHostByAddress() [2/2]

static IPHostEntry System.Net.Dns.GetHostByAddress ( IPAddress  address)
static

Creates an T:System.Net.IPHostEntry instance from the specified T:System.Net.IPAddress.

Parameters
addressAn T:System.Net.IPAddress.
Returns
An T:System.Net.IPHostEntry.An T:System.Net.IPHostEntry instance.
Exceptions
T:System.ArgumentNullExceptionaddress is null.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving address .

Definition at line 184 of file Dns.cs.

◆ GetHostByName()

static IPHostEntry System.Net.Dns.GetHostByName ( string  hostName)
static

Gets the DNS information for the specified DNS host name.

Parameters
hostNameThe DNS name of the host.
Returns
An T:System.Net.IPHostEntry object that contains host information for the address specified in hostName .
Exceptions
T:System.ArgumentNullExceptionhostName is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostName is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving hostName .

Definition at line 89 of file Dns.cs.

◆ GetHostEntry() [1/2]

static IPHostEntry System.Net.Dns.GetHostEntry ( string  hostNameOrAddress)
static

Resolves a host name or IP address to an T:System.Net.IPHostEntry instance.

Parameters
hostNameOrAddressThe host name or IP address to resolve.
Returns
An T:System.Net.IPHostEntry instance that contains address information about the host specified in hostNameOrAddress .
Exceptions
T:System.ArgumentNullExceptionThe hostNameOrAddress parameter is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostNameOrAddress parameter is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error was encountered when resolving the hostNameOrAddress parameter.
T:System.ArgumentExceptionThe hostNameOrAddress parameter is an invalid IP address.

Definition at line 535 of file Dns.cs.

◆ GetHostEntry() [2/2]

static IPHostEntry System.Net.Dns.GetHostEntry ( IPAddress  address)
static

Resolves an IP address to an T:System.Net.IPHostEntry instance.

Parameters
addressAn IP address.
Returns
An T:System.Net.IPHostEntry instance that contains address information about the host specified in address .
Exceptions
T:System.ArgumentNullExceptionaddress is null.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving address .
T:System.ArgumentExceptionaddress is an invalid IP address.

Definition at line 574 of file Dns.cs.

◆ GetHostEntryAsync() [1/2]

static Task<IPHostEntry> System.Net.Dns.GetHostEntryAsync ( IPAddress  address)
static

Resolves an IP address to an T:System.Net.IPHostEntry instance as an asynchronous operation.

Parameters
addressAn IP address.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns an T:System.Net.IPHostEntry instance that contains address information about the host specified in address .
Exceptions
T:System.ArgumentNullExceptionaddress is null.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving address .
T:System.ArgumentExceptionaddress is an invalid IP address.

Definition at line 852 of file Dns.cs.

◆ GetHostEntryAsync() [2/2]

static Task<IPHostEntry> System.Net.Dns.GetHostEntryAsync ( string  hostNameOrAddress)
static

Resolves a host name or IP address to an T:System.Net.IPHostEntry instance as an asynchronous operation.

Parameters
hostNameOrAddressThe host name or IP address to resolve.
Returns
Returns T:System.Threading.Tasks.Task`1.The task object representing the asynchronous operation. The P:System.Threading.Tasks.Task`1.Result property on the task object returns an T:System.Net.IPHostEntry instance that contains address information about the host specified in hostNameOrAddress .
Exceptions
T:System.ArgumentNullExceptionThe hostNameOrAddress parameter is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostNameOrAddress parameter is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error was encountered when resolving the hostNameOrAddress parameter.
T:System.ArgumentExceptionThe hostNameOrAddress parameter is an invalid IP address.

Definition at line 865 of file Dns.cs.

◆ GetHostName()

static string System.Net.Dns.GetHostName ( )
static

Gets the host name of the local computer.

Returns
A string that contains the DNS host name of the local computer.
Exceptions
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving the local host name.

Definition at line 249 of file Dns.cs.

◆ Resolve()

static IPHostEntry System.Net.Dns.Resolve ( string  hostName)
static

Resolves a DNS host name or IP address to an T:System.Net.IPHostEntry instance.

Parameters
hostNameA DNS-style host name or IP address.
Returns
An T:System.Net.IPHostEntry instance that contains address information about the host specified in hostName .
Exceptions
T:System.ArgumentNullExceptionhostName is null.
T:System.ArgumentOutOfRangeExceptionThe length of hostName is greater than 255 characters.
T:System.Net.Sockets.SocketExceptionAn error is encountered when resolving hostName .

Definition at line 269 of file Dns.cs.


The documentation for this class was generated from the following file: