IPEndPoint.Create(SocketAddress) Methode

Definition

Erstellt einen Endpunkt aus einer Socketadresse.

public:
 override System::Net::EndPoint ^ Create(System::Net::SocketAddress ^ socketAddress);
public override System.Net.EndPoint Create(System.Net.SocketAddress socketAddress);
override this.Create : System.Net.SocketAddress -> System.Net.EndPoint
Public Overrides Function Create (socketAddress As SocketAddress) As EndPoint

Parameter

socketAddress
SocketAddress

Der SocketAddress für den Endpunkt zu verwendende.

Gibt zurück

Eine EndPoint Instanz, die die angegebene Socketadresse verwendet.

Ausnahmen

Die AddressFamily von socketAddress ist nicht gleich der AddressFamily der aktuellen Instanz.

-oder-

socketAddress. Größe < 8.

Beispiele

Im folgenden Beispiel wird das angegebene SocketAddress Beispiel verwendet, um eine 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());
' 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()))

Gilt für:

Weitere Informationen