Socket.SetRawSocketOption(Int32, Int32, ReadOnlySpan<Byte>) Method

Definition

Sets a socket option value using platform-specific level and name identifiers.

public:
 void SetRawSocketOption(int optionLevel, int optionName, ReadOnlySpan<System::Byte> optionValue);
public void SetRawSocketOption (int optionLevel, int optionName, ReadOnlySpan<byte> optionValue);
member this.SetRawSocketOption : int * int * ReadOnlySpan<byte> -> unit
Public Sub SetRawSocketOption (optionLevel As Integer, optionName As Integer, optionValue As ReadOnlySpan(Of Byte))

Parameters

optionLevel
Int32

The platform-defined option level.

optionName
Int32

The platform-defined option name.

optionValue
ReadOnlySpan<Byte>

The value to which the option should be set.

Exceptions

The Socket has been closed.

An error occurred when attempting to access the socket.

Remarks

In general, the SetSocketOption method should be used whenever setting a Socket option.

The SetRawSocketOption(Int32, Int32, ReadOnlySpan<Byte>) method should be used only when SocketOptionLevel and SocketOptionName do not expose the required option.

Applies to