IPEndPoint.Serialize Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Serializes endpoint information into a SocketAddress instance.

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

Public Overrides Function Serialize As SocketAddress

Return Value

Type: System.Net.SocketAddress

A SocketAddress instance containing the socket address for the endpoint.

The following example uses the Serialize method to serialize endpoint information into a SocketAddress instance.

' 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.")

  Return socketAddress
End Function 'serializeEndpoint

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top