The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SocketAddress Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Stores serialized information from EndPoint derived classes.


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

public class SocketAddress

The SocketAddress type exposes the following members.

Public methodSocketAddress(AddressFamily)Creates a new instance of the SocketAddress class for the given address family.
Public methodSocketAddress(AddressFamily, Int32)Creates a new instance of the SocketAddress class using the specified address family and buffer size.

Public propertyFamilyGets the AddressFamily enumerated value of the current SocketAddress.
Public propertyItemGets or sets the specified index element in the underlying buffer.
Public propertySizeGets the available buffer size that can be used for the SocketAddress.

Public methodEqualsDetermines whether the specified Object is equal to the current SocketAddress instance. (Overrides Object.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeReturns a hash value for the SocketAddress. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents information about the socket address. (Overrides Object.ToString().)

The first 2 bytes of the underlying buffer are reserved for the AddressFamily enumerated value. When the SocketAddress is used to store a serialized IPEndPoint, the third and fourth bytes are used to store port number information. The remaining bytes are used to store the IP address. You can access any information within this underlying byte buffer by referring to its index position; the byte buffer uses zero-based indexing. You can also use the Family and Size properties to get the AddressFamily value and the buffer size, respectively. To view any of this information as a string, use the ToString method.


If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.


Windows Phone 8, Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone 8.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.