C# IPEndPoint Address
Description
IPEndPoint Address
Gets or sets the IP address of the endpoint.
Syntax
IPEndPoint.Address
has the following syntax.
public IPAddress Address { get; set; }
Example
The following example sets the Address property using the IPAddress specified.
//from ww w . ja va 2 s . c o m
using System;
using System.Net;
using System.Net.Sockets;
public class Example
{
public static void Main()
{
IPAddress hostIPAddress1 = (Dns.Resolve("google.com")).AddressList[0];
IPEndPoint endpoint = new IPEndPoint(hostIPAddress1, 80);
Console.WriteLine("Endpoint.Address : " + endpoint.Address);
Console.WriteLine("Endpoint.AddressFamily : " + endpoint.AddressFamily);
Console.WriteLine("Endpoint.Port : " + endpoint.Port);
Console.WriteLine("Endpoint.ToString() : " + endpoint.ToString());
}
}
The code above generates the following result.