SocketOptionLevel Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines socket option levels for the SetSocketOption(SocketOptionLevel, SocketOptionName, Int32) and GetSocketOption(SocketOptionLevel, SocketOptionName) methods.
public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel =
Public Enum SocketOptionLevel
- Inheritance
Fields
Name | Value | Description |
---|---|---|
IP | 0 | Socket options apply only to IP sockets. |
Tcp | 6 | Socket options apply only to TCP sockets. |
Udp | 17 | Socket options apply only to UDP sockets. |
IPv6 | 41 | Socket options apply only to IPv6 sockets. |
Socket | 65535 | Socket options apply to all sockets. |
Examples
The following example uses this enumeration to set socket options.
// Specifies that the Socket will linger for 10 seconds after Close is called.
LingerOption^ lingerOption = gcnew LingerOption(true, 10);
s->SetSocketOption(SocketOptionLevel::Socket, SocketOptionName::Linger, lingerOption);
// The socket will linger for 10 seconds after Socket.Close is called.
var lingerOption = new LingerOption(true, 10);
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption);
' The socket will linger for 10 seconds after Socket.Close is called.
Dim lingerOption As New LingerOption(True, 10)
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption)
Remarks
The SocketOptionLevel enumeration defines the socket option levels that can be passed to the Socket.SetSocketOption and Socket.GetSocketOption methods. SocketOptionName enumerated values are grouped by SocketOptionLevel.
Note To use IPv6 on Windows XP, install Advance Networking Pack for Windows XP.