This documentation is archived and is not being maintained.

IPEndPoint Constructor (Int64, Int32)

.NET Framework 1.1

Initializes a new instance of the IPEndPoint class with the specified address and port number.

[Visual Basic]
Public Sub New( _
   ByVal address As Long, _
   ByVal port As Integer _
public IPEndPoint(
   long address,
 int port
public: IPEndPoint(
   __int64 address,
 int port
public function IPEndPoint(
   address : long,
 port : int


The IP address of the Internet host.
The port number associated with the address, or 0 to specify any available port.


Exception Type Condition
ArgumentOutOfRangeException port is less than MinPort.


port is greater than MaxPort.


address is less than 0 or greater than 0x00000000FFFFFFFF.


[Visual Basic, C#, C++] The following example uses the specified IP address and port number to create an IPEndPoint.

[Visual Basic] 
Dim hostIPAddress1 As IPAddress = Dns.Resolve(hostString1).AddressList(0)
Dim hostIPEndPoint As New IPEndPoint(hostIPAddress1, 80)
Console.WriteLine((ControlChars.Cr + "IPEndPoint information:" + hostIPEndPoint.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Maximum allowed Port Address :" + IPEndPoint.MaxPort.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Minimum allowed Port Address :" + IPEndPoint.MinPort.ToString()))
Console.WriteLine((ControlChars.Cr + ControlChars.Tab + "Address Family :" + hostIPEndPoint.AddressFamily.ToString()))



            IPAddress hostIPAddress1 = (Dns.Resolve(hostString1)).AddressList[0];
            IPEndPoint hostIPEndPoint = new IPEndPoint(hostIPAddress1,80);
            Console.WriteLine("\nIPEndPoint information:" + hostIPEndPoint.ToString());
            Console.WriteLine("\n\tMaximum allowed Port Address :" + IPEndPoint.MaxPort);
            Console.WriteLine("\n\tMinimum allowed Port Address :" + IPEndPoint.MinPort);
            Console.WriteLine("\n\tAddress Family :" + hostIPEndPoint.AddressFamily);

IPAddress* hostIPAddress1 = (Dns::Resolve(hostString1))->AddressList[0];
IPEndPoint* hostIPEndPoint = new IPEndPoint(hostIPAddress1,80);
Console::WriteLine(S"\nIPEndPoint information:{0}", hostIPEndPoint);
Console::WriteLine(S"\n\tMaximum allowed Port Address :{0}", __box(IPEndPoint::MaxPort));
Console::WriteLine(S"\n\tMinimum allowed Port Address :{0}", __box(IPEndPoint::MinPort));
Console::WriteLine(S"\n\tAddress Family :{0}", __box(hostIPEndPoint->AddressFamily));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

IPEndPoint Class | IPEndPoint Members | System.Net Namespace | IPEndPoint Constructor Overload List