SocketOptionName Enumeration
Defines configuration option names.
Assembly: System (in System.dll)
| Member name | Description | |
|---|---|---|
![]() | Debug | Record debugging information. |
![]() | AcceptConnection | The socket is listening. |
![]() | ReuseAddress | Allows the socket to be bound to an address that is already in use. |
![]() | KeepAlive | Use keep-alives. |
![]() | DontRoute | Do not route; send the packet directly to the interface addresses. |
![]() | Broadcast | Permit sending broadcast messages on the socket. |
![]() | UseLoopback | Bypass hardware when possible. |
![]() | Linger | Linger on close if unsent data is present. |
![]() | OutOfBandInline | Receives out-of-band data in the normal data stream. |
![]() | DontLinger | Close the socket gracefully without lingering. |
![]() | ExclusiveAddressUse | Enables a socket to be bound for exclusive access. |
![]() | SendBuffer | Specifies the total per-socket buffer space reserved for sends. This is unrelated to the maximum message size or the size of a TCP window. |
![]() | ReceiveBuffer | Specifies the total per-socket buffer space reserved for receives. This is unrelated to the maximum message size or the size of a TCP window. |
![]() | SendLowWater | Specifies the low water mark for Send operations. |
![]() | ReceiveLowWater | Specifies the low water mark for Receive operations. |
![]() | SendTimeout | Send a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend method. |
![]() | ReceiveTimeout | Receive a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend method. |
![]() | Error | Get the error status and clear. |
![]() | Type | Get the socket type. |
![]() | MaxConnections | Not supported; will throw a SocketException if used. |
![]() | IPOptions | Specifies the IP options to be inserted into outgoing datagrams. |
![]() | HeaderIncluded | Indicates that the application provides the IP header for outgoing datagrams. |
![]() | TypeOfService | Change the IP header type of the service field. |
![]() | IpTimeToLive | Set the IP header Time-to-Live field. |
![]() | MulticastInterface | Set the interface for outgoing multicast packets. |
![]() | MulticastTimeToLive | An IP multicast Time to Live. |
![]() | MulticastLoopback | An IP multicast loopback. |
![]() | AddMembership | Add an IP group membership. |
![]() | DropMembership | Drop an IP group membership. |
![]() | DontFragment | Do not fragment IP datagrams. |
![]() | AddSourceMembership | Join a source group. |
![]() | DropSourceMembership | Drop a source group. |
![]() | BlockSource | Block data from a source. |
![]() | UnblockSource | Unblock a previously blocked source. |
![]() | PacketInformation | Return information about received packets. |
| HopLimit | Specifies the maximum number of router hops for an Internet Protocol version 6 (IPv6) packet. This is similar to Time to Live (TTL) for Internet Protocol version 4. | |
![]() | NoDelay | Disables the Nagle algorithm for send coalescing. |
![]() | BsdUrgent | Use urgent data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off. |
![]() | Expedited | Use expedited data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off. |
![]() | NoChecksum | Send UDP datagrams with checksum set to zero. |
![]() | ChecksumCoverage | Set or get the UDP checksum coverage. |
| UpdateAcceptContext | Updates an accepted socket's properties by using those of an existing socket. This is equivalent to using the Winsock2 SO_UPDATE_ACCEPT_CONTEXT socket option and is supported only on connection-oriented sockets. | |
| UpdateConnectContext | Updates a connected socket's properties by using those of an existing socket. This is equivalent to using the Winsock2 SO_UPDATE_CONNECT_CONTEXT socket option and is supported only on connection-oriented sockets. |
The SocketOptionName enumeration defines the name of each Socket configuration option. Sockets can be configured with the Socket.SetSocketOption method.
Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE Platform Note: In .NET Compact Framework applications, the following options are supported but are not currently usable and are reserved for future use: AcceptConnection, ReceiveLowWater, ReceiveTimeout, SendLowWater, SendTimeout, and Type. In addition, ReceiveBuffer is supported only for sockets of the Windows CE Winsock type SOCK_DGRAM, which are datagram-oriented sockets. The default receive buffer size is 32768 bytes and cannot be set with ReceiveBuffer. For more information about using sockets on the .NET Compact Framework, see Socket Programming.
The following code example uses this enumeration to set socket options.
'Send operations will time-out if confirmation is ' not received within 1000 milliseconds. s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 1000) ' 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)
// Specifies that send operations will time-out // if confirmation is not received within 1000 milliseconds. s->SetSocketOption(SocketOptionLevel::Socket, SocketOptionName::SendTimeout, 1000); // Specifies that the Socket will linger for 10 seconds after Close is called. LingerOption *lingerOption = new LingerOption(true, 10); s->SetSocketOption(SocketOptionLevel::Socket, SocketOptionName::Linger, lingerOption);
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
