SocketOptionName Enumeration
Defines Socket configuration option names for the Socket class.
[Visual Basic] <Serializable> Public Enum SocketOptionName [C#] [Serializable] public enum SocketOptionName [C++] [Serializable] __value public enum SocketOptionName [JScript] public Serializable enum SocketOptionName
Remarks
SocketOptionName defines the names of each Socket configuration option. Sockets can be configured with the Socket.SetSocketOption method.
Members
| Member name | Description |
|---|---|
| AcceptConnection Supported by the .NET Compact Framework. | Socket is listening. |
| AddMembership Supported by the .NET Compact Framework. | Add an IP group membership. |
| AddSourceMembership Supported by the .NET Compact Framework. | Join a source group. |
| BlockSource Supported by the .NET Compact Framework. | Block data from a source. |
| Broadcast Supported by the .NET Compact Framework. | Permit sending broadcast messages on the socket. |
| BsdUrgent Supported by the .NET Compact Framework. | Use urgent data as defined in RFC-1222. This option can be set only once, and once set, cannot be turned off. |
| ChecksumCoverage Supported by the .NET Compact Framework. | Set or get UDP checksum coverage. |
| Debug Supported by the .NET Compact Framework. | Record debugging information. |
| DontFragment Supported by the .NET Compact Framework. | Do not fragment IP datagrams. |
| DontLinger Supported by the .NET Compact Framework. | Close socket gracefully without lingering. |
| DontRoute Supported by the .NET Compact Framework. | Do not route; send directly to interface addresses. |
| DropMembership Supported by the .NET Compact Framework. | Drop an IP group membership. |
| DropSourceMembership Supported by the .NET Compact Framework. | Drop a source group. |
| Error Supported by the .NET Compact Framework. | Get error status and clear. |
| ExclusiveAddressUse Supported by the .NET Compact Framework. | Enables a socket to be bound for exclusive access. |
| Expedited Supported by the .NET Compact Framework. | Use expedited data as defined in RFC-1222. This option can be set only once, and once set, cannot be turned off. |
| HeaderIncluded Supported by the .NET Compact Framework. | Indicates application is providing the IP header for outgoing datagrams. |
| IPOptions Supported by the .NET Compact Framework. | Specifies IP options to be inserted into outgoing datagrams. |
| IpTimeToLive Supported by the .NET Compact Framework. | Set the IP header time-to-live field. |
| KeepAlive Supported by the .NET Compact Framework. | Send keep-alives. |
| Linger Supported by the .NET Compact Framework. | Linger on close if unsent data is present. |
| MaxConnections Supported by the .NET Compact Framework. | Maximum queue length that can be specified by Listen. |
| MulticastInterface Supported by the .NET Compact Framework. | Set the interface for outgoing multicast packets. |
| MulticastLoopback Supported by the .NET Compact Framework. | IP multicast loopback. |
| MulticastTimeToLive Supported by the .NET Compact Framework. | IP multicast time to live. |
| NoChecksum Supported by the .NET Compact Framework. | Send UDP datagrams with checksum set to zero. |
| NoDelay Supported by the .NET Compact Framework. | Disables the Nagle algorithm for send coalescing. |
| OutOfBandInline Supported by the .NET Compact Framework. | Receives out-of-band data in the normal data stream. |
| PacketInformation Supported by the .NET Compact Framework. | Return information about received packets. |
| ReceiveBuffer Supported by the .NET Compact Framework. | Send low water mark. |
| ReceiveLowWater Supported by the .NET Compact Framework. | Receive low water mark. |
| ReceiveTimeout Supported by the .NET Compact Framework. | Receive time out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as BeginSend. |
| ReuseAddress Supported by the .NET Compact Framework. | Allows the socket to be bound to an address that is already in use. |
| SendBuffer Supported by the .NET Compact Framework. | 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. |
| SendLowWater Supported by the .NET Compact Framework. | 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. |
| SendTimeout Supported by the .NET Compact Framework. | Send timeout. This option applies only to synchronous methods; it has no effect on asynchronous methods such as BeginSend. |
| Type Supported by the .NET Compact Framework. | Get socket type. |
| TypeOfService Supported by the .NET Compact Framework. | Change the IP header type of service field. |
| UnblockSource Supported by the .NET Compact Framework. | Unblock a previously blocked source. |
| UseLoopback Supported by the .NET Compact Framework. | Bypass hardware when possible. |
Example
[Visual Basic, C#, C++] The following example uses this enumeration to set socket options.
[Visual Basic] '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) [C#] // 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. LingerOption lingerOption = new LingerOption (true, 10); s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption); [C++] // 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);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Net.Sockets
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: System (in System.dll)
See Also
System.Net.Sockets Namespace | SocketOptionLevel | SocketOptionName