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)

'Declaration
Public Sub GetSocketOption ( _
	optionLevel As SocketOptionLevel, _
	optionName As SocketOptionName, _
	val As Byte() _
)

Parameters

optionLevel
Type: System.Net.Sockets..::..SocketOptionLevel
One of the SocketOptionLevel values.
optionName
Type: System.Net.Sockets..::..SocketOptionName
One of the SocketOptionName values.
val
Type: array<System..::..Byte>[]()[][]
An array of type Byte that is to receive the option setting.

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.

Show: