GetSocketOption Method (SocketOptionLevel, SocketOptionName)

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

Returns the value of a specified Socket option, represented as an object.

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

member GetSocketOption : 
        optionLevel:SocketOptionLevel * 
        optionName:SocketOptionName -> Object 


Type: System.Net.Sockets..::..SocketOptionLevel
One of the SocketOptionLevel values.
Type: System.Net.Sockets..::..SocketOptionName
One of the SocketOptionName values.

Return Value

Type: System..::..Object
An object that represents the value of the option. When the optionName parameter is set to Linger the return value is an instance of the LingerOption class. When optionName is set to AddMembership or DropMembership, the return value is an instance of the MulticastOption class. When optionName is any other value, the return value is an integer.

Socket options determine the behavior of the current Socket. Use this overload to get the Linger, AddMembership, and DropMembership Socket options. For the Linger option, use Socket for the optionLevel parameter. For AddMembership and DropMembership, use IP. If you want to set the value of any of the options listed above, use the SetSocketOption method.