public enum SocketFlags
None
No flags are set.
None = 0
OutOfBand
Process the out-of-band data. For TCP/IP, out-of-band data is a single byte of urgent data that is sent before other data in the stream.
OutOfBand = 1
Peek
Indicates that the data should be received without removing it from the input queue. This is useful for examining incoming data without consuming it.
Peek = 2
DontRoute
Specifies that the data should not be routed. This flag is typically used by diagnostic tools or for testing.
DontRoute = 4
Broadcast
Specifies that the datagram should be sent as a broadcast.
Broadcast = 8
Multicast
Specifies that the datagram should be sent as a multicast.
Multicast = 16
Firewall
This flag is reserved for future use.
Firewall = 32
Truncate
Indicates that the data has been truncated. This flag is returned by the ReceiveFrom method to indicate that the buffer was too small to hold the entire datagram.
Truncate = 64
DoNotFragment
Specifies that the datagram should not be fragmented.
DoNotFragment = 128
ExtendCounts
Specifies that the socket options should be extended. This flag is used to get extended statistics for socket operations.
ExtendCounts = 1073741824
SocketFlags enumeration is used to specify options for socket operations such as sending and receiving data. These flags allow for fine-grained control over how socket operations are performed, enabling features like processing out-of-band data, peeking at incoming data without consuming it, and specifying broadcast or multicast transmissions.
SocketFlags.Peek to inspect the data without removing it from the buffer, or SocketFlags.Truncate to indicate that the received data was larger than the provided buffer. When sending data, SocketFlags.Broadcast and SocketFlags.Multicast are used to direct datagrams to multiple recipients.
|) to specify a combination of options.