Share via


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)

Syntax

'Declaration
Public Function GetSocketOption ( _
    optionLevel As SocketOptionLevel, _
    optionName As SocketOptionName _
) As Object
public Object GetSocketOption(
    SocketOptionLevel optionLevel,
    SocketOptionName optionName
)
public:
Object^ GetSocketOption(
    SocketOptionLevel optionLevel, 
    SocketOptionName optionName
)
member GetSocketOption : 
        optionLevel:SocketOptionLevel * 
        optionName:SocketOptionName -> Object 
public function GetSocketOption(
    optionLevel : SocketOptionLevel, 
    optionName : SocketOptionName
) : Object

Parameters

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.

Remarks

Socket options determine the behavior of the current Socket. Use this overload to get the Linger, AddMembership, and DropMembershipSocket 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.

.NET Framework Security

See Also

Reference

Socket Class

GetSocketOption Overload

System.Net.Sockets Namespace