Export (0) Print
Expand All
0 out of 7 rated this helpful - Rate this topic

SocketOptionName Enumeration

Defines configuration option names.

Namespace: System.Net.Sockets
Assembly: System (in system.dll)

public enum SocketOptionName
public enum SocketOptionName
public enum SocketOptionName
 Member nameDescription
Supported by the .NET Compact FrameworkAcceptConnectionThe socket is listening. 
Supported by the .NET Compact FrameworkAddMembershipAdd an IP group membership. 
Supported by the .NET Compact FrameworkAddSourceMembershipJoin a source group. 
Supported by the .NET Compact FrameworkBlockSourceBlock data from a source. 
Supported by the .NET Compact FrameworkBroadcastPermit sending broadcast messages on the socket. 
Supported by the .NET Compact FrameworkBsdUrgentUse urgent data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off. 
Supported by the .NET Compact FrameworkChecksumCoverageSet or get the UDP checksum coverage. 
Supported by the .NET Compact FrameworkDebugRecord debugging information. 
Supported by the .NET Compact FrameworkDontFragmentDo not fragment IP datagrams. 
Supported by the .NET Compact FrameworkDontLingerClose the socket gracefully without lingering. 
Supported by the .NET Compact FrameworkDontRouteDo not route; send the packet directly to the interface addresses. 
Supported by the .NET Compact FrameworkDropMembershipDrop an IP group membership. 
Supported by the .NET Compact FrameworkDropSourceMembershipDrop a source group. 
Supported by the .NET Compact FrameworkErrorGet the error status and clear. 
Supported by the .NET Compact FrameworkExclusiveAddressUseEnables a socket to be bound for exclusive access. 
Supported by the .NET Compact FrameworkExpeditedUse expedited data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off. 
Supported by the .NET Compact FrameworkHeaderIncludedIndicates that the application provides the IP header for outgoing datagrams. 
HopLimitSpecifies 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. 
Supported by the .NET Compact FrameworkIPOptionsSpecifies the IP options to be inserted into outgoing datagrams. 
Supported by the .NET Compact FrameworkIpTimeToLiveSet the IP header Time-to-Live field. 
Supported by the .NET Compact FrameworkKeepAliveUse keep-alives. 
Supported by the .NET Compact FrameworkLingerLinger on close if unsent data is present. 
Supported by the .NET Compact FrameworkMaxConnectionsNot supported; will throw a SocketException if used. 
Supported by the .NET Compact FrameworkMulticastInterfaceSet the interface for outgoing multicast packets. 
Supported by the .NET Compact FrameworkMulticastLoopbackAn IP multicast loopback. 
Supported by the .NET Compact FrameworkMulticastTimeToLiveAn IP multicast Time to Live. 
Supported by the .NET Compact FrameworkNoChecksumSend UDP datagrams with checksum set to zero. 
Supported by the .NET Compact FrameworkNoDelayDisables the Nagle algorithm for send coalescing. 
Supported by the .NET Compact FrameworkOutOfBandInlineReceives out-of-band data in the normal data stream. 
Supported by the .NET Compact FrameworkPacketInformationReturn information about received packets. 
Supported by the .NET Compact FrameworkReceiveBufferSpecifies the total per-socket buffer space reserved for receives. This is unrelated to the maximum message size or the size of a TCP window. 
Supported by the .NET Compact FrameworkReceiveLowWaterSpecifies the low water mark for Receive operations. 
Supported by the .NET Compact FrameworkReceiveTimeoutReceive a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend method. 
Supported by the .NET Compact FrameworkReuseAddressAllows the socket to be bound to an address that is already in use. 
Supported by the .NET Compact FrameworkSendBufferSpecifies the total per-socket buffer space reserved for sends. This is unrelated to the maximum message size or the size of a TCP window. 
Supported by the .NET Compact FrameworkSendLowWaterSpecifies the low water mark for Send operations. 
Supported by the .NET Compact FrameworkSendTimeoutSend a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend method. 
Supported by the .NET Compact FrameworkTypeGet the socket type. 
Supported by the .NET Compact FrameworkTypeOfServiceChange the IP header type of the service field. 
Supported by the .NET Compact FrameworkUnblockSourceUnblock a previously blocked source. 
UpdateAcceptContextUpdates 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. 
UpdateConnectContextUpdates 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. 
Supported by the .NET Compact FrameworkUseLoopbackBypass hardware when possible. 

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. For more information about these options, 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.
LingerOption lingerOption = new LingerOption (true, 10);

s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption);


// 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);

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.