Share via


GetSocketOption Method (SocketOptionLevel, SocketOptionName, Byte[])

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Returns the specified Socket option setting, represented as a byte array.

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

Syntax

'Declaration
Public Sub GetSocketOption ( _
    optionLevel As SocketOptionLevel, _
    optionName As SocketOptionName, _
    val As Byte() _
)
public void GetSocketOption(
    SocketOptionLevel optionLevel,
    SocketOptionName optionName,
    byte[] val
)
public:
void GetSocketOption(
    SocketOptionLevel optionLevel, 
    SocketOptionName optionName, 
    array<unsigned char>^ val
)
member GetSocketOption : 
        optionLevel:SocketOptionLevel * 
        optionName:SocketOptionName * 
        val:byte[] -> unit 
public function GetSocketOption(
    optionLevel : SocketOptionLevel, 
    optionName : SocketOptionName, 
    val : byte[]
)

Parameters

Remarks

Socket options determine the behavior of the current Socket. Upon successful completion of this method, the array specified by the val parameter contains the value of the specified Socket option.

When the length of the val array is smaller than the number of bytes required to store the value of the specified Socket option, GetSocketOption will throw a SocketException. If you receive a SocketException, use the SocketException..::..ErrorCode property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. Use this overload for any sockets that are represented by Boolean values or integers.

.NET Framework Security

See Also

Reference

Socket Class

GetSocketOption Overload

System.Net.Sockets Namespace