Comparteix a través de


IPEndPoint.Create(SocketAddress) Método

Definición

Crea un extremo a partir de una dirección del socket.

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

Parámetros

socketAddress
SocketAddress

SocketAddress que se debe utilizar para el extremo.

Devoluciones

Instancia de EndPoint que utiliza la dirección del socket especificado.

Excepciones

AddressFamily de socketAddress no es igual que AddressFamily de la instancia actual.

o bien

socketAddress.Size < 8.

Ejemplos

En el ejemplo siguiente se usa el especificado SocketAddress para crear un IPEndPointobjeto .

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

Se aplica a

Consulte también