Export (0) Print
Expand All

IPEndPoint.Create Method

Creates an endpoint from a socket address.

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

Parameters

socketAddress
The SocketAddress to use for the endpoint.

Return Value

An EndPoint instance using the specified socket address.

Exceptions

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

-or-

socketAddress.Size < 8.

Example

[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()))

[C#] 
// 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());

[C++] 
// 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.

Requirements

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

Show:
© 2014 Microsoft