Socket.GetRawSocketOption(Int32, Int32, Span<Byte>) Method

Definition

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

public:
 int GetRawSocketOption(int optionLevel, int optionName, Span<System::Byte> optionValue);
public int GetRawSocketOption (int optionLevel, int optionName, Span<byte> optionValue);
member this.GetRawSocketOption : int * int * Span<byte> -> int
Public Function GetRawSocketOption (optionLevel As Integer, optionName As Integer, optionValue As Span(Of Byte)) As Integer

Parameters

optionLevel
Int32

The platform-defined option level.

optionName
Int32

The platform-defined option name.

optionValue
Span<Byte>

The span into which the retrieved option value should be stored.

Returns

Int32

The number of bytes written into optionValue for a successfully retrieved value.

Exceptions

The Socket has been closed.

An error occurred when attempting to access the socket.

Remarks

In general, the GetSocketOption method should be used whenever getting a Socket option.

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

Applies to