Freigeben über


IPEndPoint.Create-Methode

Erstellt einen Endpunkt aus einer Socketadresse.

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

Syntax

'Declaration
Public Overrides Function Create ( _
    socketAddress As SocketAddress _
) As EndPoint
'Usage
Dim instance As IPEndPoint
Dim socketAddress As SocketAddress
Dim returnValue As EndPoint

returnValue = instance.Create(socketAddress)
public override EndPoint Create (
    SocketAddress socketAddress
)
public:
virtual EndPoint^ Create (
    SocketAddress^ socketAddress
) override
public EndPoint Create (
    SocketAddress socketAddress
)
public override function Create (
    socketAddress : SocketAddress
) : EndPoint

Parameter

  • socketAddress
    Die SocketAddress, die für den Endpunkt verwendet werden soll.

Rückgabewert

Eine EndPoint-Instanz, die die angegebene Socketadresse verwendet.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentException

Die AddressFamily von socketAddress entspricht nicht der AddressFamily der aktuellen Instanz.

– oder –

socketAddress.Size < 8.

Beispiel

Im folgenden Beispiel wird die angegebene SocketAddress zum Erstellen eines IPEndPoint verwendet.

' 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 = gcnew IPEndPoint( (__int64)0,0 );
IPEndPoint^ clonedIPEndPoint = dynamic_cast<IPEndPoint^>(endpoint->Create( socketAddress ));
Console::WriteLine( "clonedIPEndPoint: {0}", clonedIPEndPoint );
// 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()));

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

IPEndPoint-Klasse
IPEndPoint-Member
System.Net-Namespace
EndPoint-Klasse
SocketAddress