C# Dns GetHostEntry(IPAddress)
Description
Dns GetHostEntry(IPAddress)
Resolves an IP address
to an IPHostEntry instance.
Syntax
Dns.GetHostEntry(IPAddress)
has the following syntax.
public static IPHostEntry GetHostEntry(
IPAddress address
)
Parameters
Dns.GetHostEntry(IPAddress)
has the following parameters.
address
- An IP address.
Returns
Dns.GetHostEntry(IPAddress)
method returns An IPHostEntry instance that contains address information about the host
specified in address.
Example
//w ww. j av a 2 s . co m
using System;
using System.Net;
using System.Net.Sockets;
public class Example
{
public static void Main()
{
IPHostEntry host = Dns.GetHostEntry("google.com");
Console.WriteLine("GetHostEntry({0}) returns:", host);
foreach (IPAddress ip in host.AddressList)
{
Console.WriteLine(" {0}", ip);
}
}
}
The code above generates the following result.