This documentation is archived and is not being maintained.

IPEndPoint.Create Method

Creates an endpoint from a socket address.

[Visual Basic]
Overrides Public Function Create( _
   ByVal socketAddress As SocketAddress _
) As EndPoint
public override EndPoint Create(
 SocketAddress socketAddress
public: EndPoint* Create(
 SocketAddress* socketAddress
public override function Create(
   socketAddress : SocketAddress
) : EndPoint;


The SocketAddress to use for the endpoint.

Return Value

An EndPoint instance using the specified socket address.


Exception Type Condition
ArgumentException The AddressFamily of socketAddress is not equal to the AddressFamily of the current instance.


socketAddress.Size < 8.


[Visual Basic, C#, C++] The following example uses the specified SocketAddress to create an IPEndPoint.

[Visual Basic] 
' Recreate the connection endpoint from the serialized information.
Dim endpoint As New IPEndPoint(0, 0)
Dim clonedIPEndPoint As IPEndPoint = CType(endpoint.Create(socketAddress), IPEndPoint)
Console.WriteLine(("clonedIPEndPoint: " + clonedIPEndPoint.ToString()))

// Recreate the connection endpoint from the serialized information.
IPEndPoint endpoint = new IPEndPoint(0,0);
IPEndPoint clonedIPEndPoint = (IPEndPoint) endpoint.Create(socketAddress);
Console.WriteLine("clonedIPEndPoint: " + clonedIPEndPoint.ToString());

// Recreate the connection endpoint from the serialized information.
IPEndPoint* endpoint = new IPEndPoint((__int64)0,0);
IPEndPoint* clonedIPEndPoint = dynamic_cast<IPEndPoint*> (endpoint->Create(socketAddress));
Console::WriteLine(S"clonedIPEndPoint: {0}", clonedIPEndPoint);

[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 | EndPoint | SocketAddress