SocketFlags SocketFlags SocketFlags SocketFlags Enum

定義

ソケットの送受信の動作を指定します。Specifies socket send and receive behaviors.

この列挙型には FlagsAttribute 属性があり、メンバー値ではビットごとの組み合わせを使用できます。

public enum class SocketFlags
[System.Flags]
public enum SocketFlags
type SocketFlags = 
Public Enum SocketFlags
継承
属性

フィールド

Broadcast Broadcast Broadcast Broadcast 1024

ブロードキャスト パケットを示します。Indicates a broadcast packet.

ControlDataTruncated ControlDataTruncated ControlDataTruncated ControlDataTruncated 512

コントロール データが内部の 64 KB のバッファーに収まらず、切り捨てられたことを示します。Indicates that the control data did not fit into an internal 64-KB buffer and was truncated.

DontRoute DontRoute DontRoute DontRoute 4

ルーティング テーブルを使用せずに送信します。Send without using routing tables.

MaxIOVectorLength MaxIOVectorLength MaxIOVectorLength MaxIOVectorLength 16

データの送受信に使用される WSABUF 構造体の数の標準値を指定します。Provides a standard value for the number of WSABUF structures that are used to send and receive data. .NET Framework 4.5.NET Framework 4.5 ではこの値は使用されないか、またはサポートされていません。This value is not used or supported on .NET Framework 4.5.NET Framework 4.5.

Multicast Multicast Multicast Multicast 2048

マルチキャスト パケットを示します。Indicates a multicast packet.

None None None None 0

この呼び出しにはフラグを使用しません。Use no flags for this call.

OutOfBand OutOfBand OutOfBand OutOfBand 1

帯域外データを処理します。Process out-of-band data.

Partial Partial Partial Partial 32768

部分的にメッセージを送信または受信します。Partial send or receive for message.

Peek Peek Peek Peek 2

受信メッセージをプレビューします。Peek at the incoming message.

Truncated Truncated Truncated Truncated 256

メッセージは大きすぎて指定されたバッファーに収まらず、切り捨てられました。The message was too large to fit into the specified buffer and was truncated.

次の例は、データを送信し、None を指定しますNoneします。The following example sends data and specifies None for None.

// 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;
}
// Displays sending with a connected socket
// using the overload that takes a buffer, message size, and socket flags.
public static int SendReceiveTest3(Socket server)
{
    byte[] msg = Encoding.UTF8.GetBytes("This is a test");
    byte[] bytes = new byte[256];
    try 
    {
        // Blocks until send returns.
        int i = server.Send(msg, msg.Length, SocketFlags.None);
        Console.WriteLine("Sent {0} bytes.", i);
        
        // 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);
        return (e.ErrorCode);
    }
    return 0;
}
' Displays sending with a connected socket
' using the overload that takes a buffer, message size, and socket flags.
Public Shared Function SendReceiveTest3(ByVal server As Socket) As Integer 
    Dim msg As Byte() = Encoding.UTF8.GetBytes("This is a test")
    Dim bytes(255) As Byte
    Try
        ' Blocks until send returns.
        Dim i As Integer = server.Send(msg, msg.Length, SocketFlags.None)
        Console.WriteLine("Sent {0} bytes.", i)
        
        ' Get reply from the server.
        Dim byteCount As Integer = server.Receive(bytes, server.Available, SocketFlags.None)
        If byteCount > 0 Then
            Console.WriteLine(Encoding.UTF8.GetString(bytes))
        End If
    Catch e As SocketException
        Console.WriteLine("{0} Error code: {1}.", e.Message, e.ErrorCode)
        Return e.ErrorCode
    End Try
    Return 0

End Function 'SendReceiveTest3

適用対象