Export (0) Print
Expand All

IPEndPoint.Create Method

Creates an endpoint from a socket address.

Namespace:  System.Net
Assembly:  System (in System.dll)

public override EndPoint Create(
	SocketAddress socketAddress
)

Parameters

socketAddress
Type: System.Net.SocketAddress

The SocketAddress to use for the endpoint.

Return Value

Type: System.Net.EndPoint
An EndPoint instance using the specified socket address.

ExceptionCondition
ArgumentException

The AddressFamily of socketAddress is not equal to the AddressFamily of the current instance.

-or-

socketAddress.Size < 8.

The following example uses the specified SocketAddress to create an IPEndPoint.

// 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());

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft