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

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

Socket.SendTimeout プロパティ

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

同期Send 呼び出しタイムアウトするまでの合計時間指定する値を取得または設定します

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

Dim instance As Socket
Dim value As Integer

value = instance.SendTimeout

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

/** @property */
public void set_SendTimeout (int
 value)
public function get SendTimeout
 () : int

public function set SendTimeout
 (value : int)

プロパティ
タイムアウト値 (ミリ秒単位)。プロパティに 1 から 499 までの値を設定しても、その値は 500変更されます。既定値は 0 で、タイムアウト無期限であることを示します。-1 の指定も、タイムアウト無期限であることを示します

例外例外
例外種類条件

SocketException

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

ObjectDisposedException

Socket閉じられています。

ArgumentOutOfRangeException

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

解説解説
使用例使用例

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

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.SendTimeout プロパティ」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS