Type Summary
public sealed class Dns
{
// Methods
public static IAsyncResult BeginGetHostByName(string hostName,
AsyncCallback requestCallback,
object stateObject);
public static IAsyncResult BeginResolve(string hostName,
AsyncCallback requestCallback,
object stateObject);
public static IPHostEntry EndGetHostByName(IAsyncResult asyncResult);
public static IPHostEntry EndResolve(IAsyncResult asyncResult);
public static IPHostEntry GetHostByAddress(IPAddress address);
public static IPHostEntry GetHostByAddress(string address);
public static IPHostEntry GetHostByName(string hostName);
public static string GetHostName();
public static IPHostEntry Resolve(string hostName);
}
|
LO
If you're using sockets in conjunction with this API, remember to construct the socket using the address family from the address in IPHostEntry instead of constructing the socket first. This will ensure that the socket created is compatible in terms of IPv4/IPv6. Also, remember to cycle through the addresses in the list when attempting to connect, rather than just trying the first one and failing if that one doesn't connect. |
|