Compartilhar via


IPEndPoint.Create(SocketAddress) Método

Definição

Cria um ponto de extremidade de um endereço de soquete.

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

O SocketAddress a ser usado para o ponto de extremidade.

Retornos

Uma instância de EndPoint usando o endereço do soquete especificado.

Exceções

O AddressFamily de socketAddress não é igual ao AddressFamily da instância atual.

- ou -

socketAddress.Size < 8.

Exemplos

O exemplo a seguir usa o especificado SocketAddress para criar um IPEndPoint.

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

Aplica-se a

Confira também