SocketAddress Class
TOC
Collapse the table of content
Expand the table of content

SocketAddress Class

 

Stores serialized information from EndPoint derived classes.

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

System.Object
  System.Net.SocketAddress

type SocketAddress = class end

NameDescription
System_CAPS_pubmethodSocketAddress(AddressFamily)

Creates a new instance of the SocketAddress class for the given address family.

System_CAPS_pubmethodSocketAddress(AddressFamily, Int32)

Creates a new instance of the SocketAddress class using the specified address family and buffer size.

NameDescription
System_CAPS_pubpropertyFamily

Gets the AddressFamily enumerated value of the current SocketAddress.

System_CAPS_pubpropertyItem(Int32)

Gets or sets the specified index element in the underlying buffer.

System_CAPS_pubpropertySize

Gets the underlying buffer size of the SocketAddress.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified Object is equal to the current Object.(Overrides Object.Equals(Object).)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.(Overrides Object.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns 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 next 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.

The following example demonstrates how to use SocketAddress to serialize an instance of the EndPoint class. After serialization, the underlying byte buffer of the SocketAddress contains all of the IPEndPoint state information.

No code example is currently available or this language may not be supported.

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

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

Return to top
Show:
© 2016 Microsoft