Share via


SetSocketOption Method (SocketOptionLevel, SocketOptionName, Byte[])

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

Sets the specified Socket option to the specified value, represented as a byte array.

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

Syntax

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

Parameters

  • optionValue
    Type: array<System. . :: . .Byte> [] () [] []
    An array of type Byte that represents the value of the option.

Remarks

Socket options determine the behavior of the current Socket. Use this overload to set those Socket options that require a byte array as an option value.

Note

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.

.NET Framework Security

See Also

Reference

Socket Class

SetSocketOption Overload

System.Net.Sockets Namespace