IPEndPoint.Create Method (SocketAddress)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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.

Exception Condition
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());

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top
Show: