Table of Contents

Enum SocketOptionName

Namespace
System.Net.Sockets
Assembly
System.Net.dll

Defines socket option names for the Socket class.

public enum SocketOptionName

Fields

AcceptConnection = 2

Socket is listening.

AddMembership = 12

Add an IP group membership.

AddSourceMembership = 15

Join IP group/source.

BlockSource = 17

Block IP group/source.

Broadcast = 32

Permit sending broadcast messages on the socket.

BsdUrgent = 2

Use urgent data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off.

ChecksumCoverage = 20

Set or get the UDP checksum coverage.

Debug = 1

Record debugging information.

DontFragment = 14

Don't fragment IP datagrams.

DontLinger = -129

Close socket gracefully without lingering.

DontRoute = 16

Do not route, send directly to interface addresses.

DropMembership = 13

Drop an IP group membership.

DropSourceMembership = 16

Leave IP group/source.

Error = 4103

Get error status and clear.

ExclusiveAddressUse = -5

Enables a socket to be bound for exclusive access.

Expedited = 2

Use expedited data as defined in RFC-1222. This option can be set only once; after it is set, it cannot be turned off.

HeaderIncluded = 2

Header is included with data.

HopLimit = 21

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.

IPOptions = 1

IP options.

IpTimeToLive = 4

IP time to live.

KeepAlive = 8

Send keep-alives.

Linger = 128

Linger on close if unsent data is present.

MaxConnections = 2147483647

Maximum queue length that can be specified by Listen(int).

MulticastInterface = 9

IP multicast interface. - Additional comments by mbolien: multicast interface You provide it with an SOCKADDR_IN, and that tells the system that it should receive multicast messages on that interface (if you have more than one interface). Binding the socket is not sufficient, since if the Ethernet hardware isnt set up to grab the multicast packets, it wont do good to bind the socket. Kinda like raw sockets. Unless you put the Ethernet card in promiscuous mode, youll only get stuff sent to and from your machine.

MulticastLoopback = 11

IP Multicast loopback.

MulticastTimeToLive = 10

IP multicast time to live.

NoChecksum = 1

Send UDP datagrams with checksum set to zero.

NoDelay = 1

Disables the Nagle algorithm for send coalescing.

OutOfBandInline = 256

Receives out-of-band data in the normal data stream.

PacketInformation = 19

Receive packet information for ipv4.

ReceiveBuffer = 4098

Send low water mark.

ReceiveLowWater = 4100

Receive low water mark.

ReceiveTimeout = 4102

Receive timeout.

ReuseAddress = 4

Allows the socket to be bound to an address that is already in use.

SendBuffer = 4097

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 = 4099

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 = 4101

Send timeout.

Type = 4104

Get socket type.

TypeOfService = 3

IP type of service and preced.

UnblockSource = 18

Unblock IP group/source.

UpdateAcceptContext = 28683

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 = 28688

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.

UseLoopback = 64

Bypass hardware when possible.

Remarks

The SocketOptionName enumeration defines the name of each Socket configuration option. Sockets can be configured with the SetSocketOption(SocketOptionLevel, SocketOptionName, bool) method.