Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
445 lines (425 sloc) 22.7 KB
<Type Name="SocketAddress" FullName="System.Net.SocketAddress">
<TypeSignature Language="C#" Value="public class SocketAddress" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit SocketAddress extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.Net.SocketAddress" />
<TypeSignature Language="VB.NET" Value="Public Class SocketAddress" />
<TypeSignature Language="C++ CLI" Value="public ref class SocketAddress" />
<TypeSignature Language="F#" Value="type SocketAddress = class" />
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Stores serialized information from <see cref="T:System.Net.EndPoint" /> derived classes.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The first 2 bytes of the underlying buffer are reserved for the <xref:System.Net.Sockets.AddressFamily> enumerated value. When the <xref:System.Net.SocketAddress> is used to store a serialized <xref:System.Net.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 <xref:System.Net.SocketAddress.Family%2A> and <xref:System.Net.SocketAddress.Size%2A> properties to get the <xref:System.Net.Sockets.AddressFamily> value and the buffer size, respectively. To view any of this information as a string, use the <xref:System.Net.SocketAddress.ToString%2A> method.
## Examples
The following example demonstrates how to use <xref:System.Net.SocketAddress> to serialize an instance of the <xref:System.Net.EndPoint> class. After serialization, the underlying byte buffer of the <xref:System.Net.SocketAddress> contains all of the <xref:System.Net.IPEndPoint> state information.
[!code-cpp[Classic SocketAddressExample#1](~/samples/snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp#1)]
[!code-csharp[Classic SocketAddressExample#1](~/samples/snippets/csharp/VS_Snippets_Remoting/Classic SocketAddressExample/CS/source.cs#1)]
[!code-vb[Classic SocketAddressExample#1](~/samples/snippets/visualbasic/VS_Snippets_Remoting/Classic SocketAddressExample/VB/source.vb#1)]
]]></format>
</remarks>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Creates a new instance of the <see cref="T:System.Net.SocketAddress" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SocketAddress (System.Net.Sockets.AddressFamily family);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.Net.Sockets.AddressFamily family) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Net.SocketAddress.#ctor(System.Net.Sockets.AddressFamily)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (family As AddressFamily)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SocketAddress(System::Net::Sockets::AddressFamily family);" />
<MemberSignature Language="F#" Value="new System.Net.SocketAddress : System.Net.Sockets.AddressFamily -&gt; System.Net.SocketAddress" Usage="new System.Net.SocketAddress family" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="family" Type="System.Net.Sockets.AddressFamily" />
</Parameters>
<Docs>
<param name="family">An <see cref="T:System.Net.Sockets.AddressFamily" /> enumerated value.</param>
<summary>Creates a new instance of the <see cref="T:System.Net.SocketAddress" /> class for the given address family.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This overload sets the underlying buffer size to 32 bytes.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SocketAddress (System.Net.Sockets.AddressFamily family, int size);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(valuetype System.Net.Sockets.AddressFamily family, int32 size) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Net.SocketAddress.#ctor(System.Net.Sockets.AddressFamily,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (family As AddressFamily, size As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SocketAddress(System::Net::Sockets::AddressFamily family, int size);" />
<MemberSignature Language="F#" Value="new System.Net.SocketAddress : System.Net.Sockets.AddressFamily * int -&gt; System.Net.SocketAddress" Usage="new System.Net.SocketAddress (family, size)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<Parameters>
<Parameter Name="family" Type="System.Net.Sockets.AddressFamily" />
<Parameter Name="size" Type="System.Int32" />
</Parameters>
<Docs>
<param name="family">An <see cref="T:System.Net.Sockets.AddressFamily" /> enumerated value.</param>
<param name="size">The number of bytes to allocate for the underlying buffer.</param>
<summary>Creates a new instance of the <see cref="T:System.Net.SocketAddress" /> class using the specified address family and buffer size.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this overload to create a new instance of the <xref:System.Net.SocketAddress> class with a particular underlying buffer size.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="size" /> is less than 2. These 2 bytes are needed to store <paramref name="family" />.</exception>
</Docs>
</Member>
<Member MemberName="Equals">
<MemberSignature Language="C#" Value="public override bool Equals (object comparand);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool Equals(object comparand) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Net.SocketAddress.Equals(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function Equals (comparand As Object) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override bool Equals(System::Object ^ comparand);" />
<MemberSignature Language="F#" Value="override this.Equals : obj -&gt; bool" Usage="socketAddress.Equals comparand" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="comparand" Type="System.Object" />
</Parameters>
<Docs>
<param name="comparand">The <see cref="T:System.Object" /> to compare with the current <see langword="Object" />.</param>
<summary>Determines whether the specified <see langword="Object" /> is equal to the current <see langword="Object" />.</summary>
<returns>
<see langword="true" /> if the specified <see langword="Object" /> is equal to the current <see langword="Object" />; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
<altmember cref="M:System.Object.Equals(System.Object)" />
</Docs>
</Member>
<Member MemberName="Family">
<MemberSignature Language="C#" Value="public System.Net.Sockets.AddressFamily Family { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Net.Sockets.AddressFamily Family" />
<MemberSignature Language="DocId" Value="P:System.Net.SocketAddress.Family" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Family As AddressFamily" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Net::Sockets::AddressFamily Family { System::Net::Sockets::AddressFamily get(); };" />
<MemberSignature Language="F#" Value="member this.Family : System.Net.Sockets.AddressFamily" Usage="System.Net.SocketAddress.Family" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Net.Sockets.AddressFamily</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:System.Net.Sockets.AddressFamily" /> enumerated value of the current <see cref="T:System.Net.SocketAddress" />.</summary>
<value>One of the <see cref="T:System.Net.Sockets.AddressFamily" /> enumerated values.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method gets the <xref:System.Net.Sockets.AddressFamily> enumerated value that represents the addressing scheme of the current <xref:System.Net.SocketAddress>. If you want to view the corresponding string representation of <xref:System.Net.Sockets.AddressFamily>, use the <xref:System.Net.SocketAddress.ToString%2A> method.
]]></format>
</remarks>
<altmember cref="T:System.Net.Sockets.AddressFamily" />
</Docs>
</Member>
<Member MemberName="GetHashCode">
<MemberSignature Language="C#" Value="public override int GetHashCode ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance int32 GetHashCode() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Net.SocketAddress.GetHashCode" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function GetHashCode () As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override int GetHashCode();" />
<MemberSignature Language="F#" Value="override this.GetHashCode : unit -&gt; int" Usage="socketAddress.GetHashCode " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.</summary>
<returns>A hash code for the current <see cref="T:System.Object" />.</returns>
<remarks>To be added.</remarks>
<altmember cref="M:System.Object.GetHashCode" />
</Docs>
</Member>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public byte this[int offset] { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance unsigned int8 Item(int32)" />
<MemberSignature Language="DocId" Value="P:System.Net.SocketAddress.Item(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Default Public Property Item(offset As Integer) As Byte" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Byte default[int] { System::Byte get(int offset); void set(int offset, System::Byte value); };" />
<MemberSignature Language="F#" Value="member this.Item(int) : byte with get, set" Usage="System.Net.SocketAddress.Item" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Byte</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="offset" Type="System.Int32" />
</Parameters>
<Docs>
<param name="offset">The array index element of the desired information.</param>
<summary>Gets or sets the specified index element in the underlying buffer.</summary>
<value>The value of the specified index element in the underlying buffer.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property gets or sets the specified byte position in the underlying buffer.
> [!NOTE]
> Be sure to call <xref:System.Net.SocketAddress.Size%2A> before referring to elements in the underlying buffer. Referring to an index that does not exist will cause the <xref:System.Net.SocketAddress> to throw an <xref:System.IndexOutOfRangeException>.
]]></format>
</remarks>
<exception cref="T:System.IndexOutOfRangeException">The specified index does not exist in the buffer.</exception>
<altmember cref="P:System.Net.SocketAddress.Size" />
</Docs>
</Member>
<Member MemberName="Size">
<MemberSignature Language="C#" Value="public int Size { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 Size" />
<MemberSignature Language="DocId" Value="P:System.Net.SocketAddress.Size" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Size As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int Size { int get(); };" />
<MemberSignature Language="F#" Value="member this.Size : int" Usage="System.Net.SocketAddress.Size" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the underlying buffer size of the <see cref="T:System.Net.SocketAddress" />.</summary>
<value>The underlying buffer size of the <see cref="T:System.Net.SocketAddress" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property gets the underlying buffer size of the <xref:System.Net.SocketAddress> in bytes.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ToString">
<MemberSignature Language="C#" Value="public override string ToString ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Net.SocketAddress.ToString" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function ToString () As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override System::String ^ ToString();" />
<MemberSignature Language="F#" Value="override this.ToString : unit -&gt; string" Usage="socketAddress.ToString " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Net.Primitives</AssemblyName>
<AssemblyVersion>4.0.10.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.1.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Net</AssemblyName>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns information about the socket address.</summary>
<returns>A string that contains information about the <see cref="T:System.Net.SocketAddress" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Net.SocketAddress.ToString%2A> method returns a string that contains the <xref:System.Net.Sockets.AddressFamily> enumerated value, the size of the underlying buffer of the <xref:System.Net.SocketAddress> structure, and the remaining contents of the buffer.
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.