Returns the specified System.Net.Sockets.Socket option setting, represented as a byte array.
- optionLevel
- One of the System.Net.Sockets.SocketOptionLevel values.
- optionName
- One of the System.Net.Sockets.SocketOptionName values.
- optionValue
- An array of type byte that is to receive the option setting.
Type Reason System.Net.Sockets.SocketException optionValue is too small to store the value of the specified socket option.
-or-
An error occurred while accessing the socket.
Note: For additional information on causes of the SocketException, see the System.Net.Sockets.SocketException class.ObjectDisposedException The current instance has been disposed.
System.Net.Sockets.Socket options determine the behavior of the current System.Net.Sockets.Socket. Upon successful completion of this method, the array specified by the optionValue parameter contains the value of the specified System.Net.Sockets.Socket option.
When the length of the optionValue array is smaller than the number of bytes required to store the value of the specified System.Net.Sockets.Socket option, Socket.GetSocketOption(SocketOptionLevel, SocketOptionName) will throw a System.Net.Sockets.SocketException. If you receive a System.Net.Sockets.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. Use this overload for any sockets that are represented by Boolean values or integers.
This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].