IPEndPoint.Serialize Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Serializza le informazioni di endpoint in un'istanza di SocketAddress.
public:
override System::Net::SocketAddress ^ Serialize();
public override System.Net.SocketAddress Serialize ();
override this.Serialize : unit -> System.Net.SocketAddress
Public Overrides Function Serialize () As SocketAddress
Restituisce
Un'istanza di SocketAddress contenente l'indirizzo del socket per l'endpoint.
Esempio
Nell'esempio seguente viene utilizzato il Serialize metodo per serializzare le informazioni sull'endpoint in un'istanza SocketAddress di .
// The serializeEndpoint function serializes the endpoint and returns the
// SocketAddress containing the serialized endpoint data.
SocketAddress^ serializeEndpoint( IPEndPoint^ endpoint )
{
// Serialize IPEndPoint details to a SocketAddress instance.
SocketAddress^ socketAddress = endpoint->Serialize();
// Display the serialized endpoint information.
Console::WriteLine( "Endpoint.Serialize() : {0}", socketAddress );
Console::WriteLine( "Socket->Family : {0}", socketAddress->Family );
Console::WriteLine( "Socket->Size : {0}", socketAddress->Size );
Console::WriteLine( "Press any key to continue." );
Console::ReadLine();
return socketAddress;
}
// The serializeEndpoint method serializes the endpoint and returns the
// SocketAddress containing the serialized endpoint data.
private static SocketAddress serializeEndpoint(IPEndPoint endpoint)
{
// Serialize IPEndPoint details to a SocketAddress instance.
SocketAddress socketAddress = endpoint.Serialize();
// Display the serialized endpoint information.
Console.WriteLine("Endpoint.Serialize() : " + socketAddress.ToString());
Console.WriteLine("Socket.Family : " + socketAddress.Family);
Console.WriteLine("Socket.Size : " + socketAddress.Size);
Console.WriteLine("Press any key to continue.");
Console.ReadLine();
return socketAddress;
}
' The serializeEndpoint method serializes the endpoint and returns the
' SocketAddress containing the serialized endpoint data.
Private Shared Function serializeEndpoint(ByVal endpoint As IPEndPoint) As SocketAddress
' Serialize IPEndPoint details to a SocketAddress instance.
Dim socketAddress As SocketAddress = endpoint.Serialize()
' Display the serialized endpoint information.
Console.WriteLine("Endpoint Serialize() : " + socketAddress.ToString())
Console.WriteLine("Socket Family : " + socketAddress.Family.ToString())
Console.WriteLine("Socket Size : " + socketAddress.ToString())
Console.WriteLine("Press any key to continue.")
Console.ReadLine()
Return socketAddress
End Function 'serializeEndpoint
Si applica a
Vedi anche
Collabora con noi su GitHub
L'origine di questo contenuto è disponibile in GitHub, in cui è anche possibile creare ed esaminare i problemi e le richieste pull. Per ulteriori informazioni, vedere la guida per i collaboratori.