Socket.SendBufferSize プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Socket.SendBufferSize プロパティの意味・解説 

Socket.SendBufferSize プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

Socket送信バッファサイズ指定する値を取得または設定します

名前空間: System.Net.Sockets
アセンブリ: System (system.dll 内)
構文構文

Dim instance As Socket
Dim value As Integer

value = instance.SendBufferSize

instance.SendBufferSize = value
public int SendBufferSize { get;
 set; }
public:
property int SendBufferSize {
    int get ();
    void set (int value);
}
/** @property */
public int get_SendBufferSize ()

/** @property */
public void set_SendBufferSize (int
 value)
public function get SendBufferSize
 () : int

public function set SendBufferSize
 (value : int)

プロパティ
送信バッファサイズ (バイト単位) を格納している Int32。既定値8192 です。

例外例外
例外種類条件

SocketException

ソケットへのアクセス試みているときにエラー発生しました

ObjectDisposedException

Socket閉じられています。

ArgumentOutOfRangeException

設定操作として指定された値が 0 未満です。

解説解説
使用例使用例

SendBufferSize プロパティ使用方法を示すコード例次に示します

static void ConfigureTcpSocket(Socket tcpSocket)
{
    // Don't allow another socket to bind to this port.
    tcpSocket.ExclusiveAddressUse = true;

    // The socket will linger for 10 seconds after 
                // Socket.Close is called.
    tcpSocket.LingerState = new LingerOption (true,
 10);

    // Disable the Nagle Algorithm for this tcp socket.
    tcpSocket.NoDelay = true;

    // Set the receive buffer size to 8k
    tcpSocket.ReceiveBufferSize = 8192;

    // Set the timeout for synchronous receive methods to 
    // 1 second (1000 milliseconds.)
    tcpSocket.ReceiveTimeout = 1000;

    // Set the send buffer size to 8k.
    tcpSocket.SendBufferSize = 8192;

    // Set the timeout for synchronous send methods
    // to 1 second (1000 milliseconds.)            
    tcpSocket.SendTimeout = 1000;

    // Set the Time To Live (TTL) to 42 router hops.
    tcpSocket.Ttl = 42;

    Console.WriteLine("Tcp Socket configured:");

    Console.WriteLine("  ExclusiveAddressUse {0}", 
                tcpSocket.ExclusiveAddressUse);

    Console.WriteLine("  LingerState {0}, {1}", 
                 tcpSocket.LingerState.Enabled, 
                     tcpSocket.LingerState.LingerTime);

    Console.WriteLine("  NoDelay {0}", 
                                        tcpSocket.NoDelay);

    Console.WriteLine("  ReceiveBufferSize {0}", 
                tcpSocket.ReceiveBufferSize);

    Console.WriteLine("  ReceiveTimeout {0}", 
                tcpSocket.ReceiveTimeout);

    Console.WriteLine("  SendBufferSize {0}", 
                tcpSocket.SendBufferSize);

    Console.WriteLine("  SendTimeout {0}", 
                                        tcpSocket.SendTimeout);

    Console.WriteLine("  Ttl {0}", 
                                        tcpSocket.Ttl);

                Console.WriteLine("  IsBound {0}", 
                                        tcpSocket.IsBound);

    Console.WriteLine("");
}
static void ConfigureTcpSocket(Socket^ tcpSocket)
{
     
    // Don't allow another socket to bind to this port.
    tcpSocket->ExclusiveAddressUse = true;
     
    // The socket will linger for 10 seconds after
    // Socket.Close is called.
    tcpSocket->LingerState = gcnew LingerOption(true, 10);
     
    // Disable the Nagle Algorithm for this tcp socket.
    tcpSocket->NoDelay = true;
     
    // Set the receive buffer size to 8k
    tcpSocket->ReceiveBufferSize = 8192;
     
    // Set the timeout for synchronous receive methods to
    // 1 second (1000 milliseconds.)
    tcpSocket->ReceiveTimeout = 1000;
     
    // Set the send buffer size to 8k.
    tcpSocket->SendBufferSize = 8192;
     
    // Set the timeout for synchronous send methods
    // to 1 second (1000 milliseconds.)
    tcpSocket->SendTimeout = 1000;
     
    // Set the Time To Live (TTL) to 42 router hops.
    tcpSocket->Ttl = 42;
    Console::WriteLine("Tcp Socket configured:");
    Console::WriteLine("  ExclusiveAddressUse {0}", 
        tcpSocket->ExclusiveAddressUse);
    Console::WriteLine("  LingerState {0}, {1}", 
        tcpSocket->LingerState->Enabled,
        tcpSocket->LingerState->LingerTime);
    Console::WriteLine("  NoDelay {0}",
        tcpSocket->NoDelay);
    Console::WriteLine("  ReceiveBufferSize {0}", 
        tcpSocket->ReceiveBufferSize);
    Console::WriteLine("  ReceiveTimeout {0}",
        tcpSocket->ReceiveTimeout);
    Console::WriteLine("  SendBufferSize {0}",
        tcpSocket->SendBufferSize);
    Console::WriteLine("  SendTimeout {0}",
        tcpSocket->SendTimeout);
    Console::WriteLine("  Ttl {0}",
        tcpSocket->Ttl);
    Console::WriteLine("  IsBound {0}",
        tcpSocket->IsBound);
    Console::WriteLine("");
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Socket.SendBufferSize プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Socket.SendBufferSize プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS