This documentation is archived and is not being maintained.
SocketFlags Enumeration
Visual Studio 2010
Specifies socket send and receive behaviors.
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Namespace: System.Net.SocketsAssembly: System (in System.dll)
| Member name | Description | |
|---|---|---|
| None | Use no flags for this call. | |
| OutOfBand | Process out-of-band data. | |
| Peek | Peek at the incoming message. | |
| DontRoute | Send without using routing tables. | |
| MaxIOVectorLength | Provides a standard value for the number of WSABUF structures that are used to send and receive data. | |
| Truncated | The message was too large to fit into the specified buffer and was truncated. | |
| ControlDataTruncated | Indicates that the control data did not fit into an internal 64-KB buffer and was truncated. | |
| Broadcast | Indicates a broadcast packet. | |
| Multicast | Indicates a multicast packet. | |
| Partial | Partial send or receive for message. |
The following example sends data and specifies None for SocketFlags.
// Displays sending with a connected socket // using the overload that takes a buffer, message size, and socket flags. int SendReceiveTest3( Socket^ server ) { array<Byte>^ msg = Encoding::UTF8->GetBytes( "This is a test" ); array<Byte>^ bytes = gcnew array<Byte>(256); try { // Blocks until send returns. int i = server->Send( msg, msg->Length, SocketFlags::None ); Console::WriteLine( "Sent {0} bytes.", i.ToString() ); // Get reply from the server. int byteCount = server->Receive( bytes, server->Available, SocketFlags::None ); if ( byteCount > 0 ) { Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); } } catch ( SocketException^ e ) { Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); return (e->ErrorCode); } return 0; }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: