TcpClient.SendTimeout プロパティ

定義

送信操作が正常に完了するのを TcpClient が待機する時間を取得または設定します。

public:
 property int SendTimeout { int get(); void set(int value); };
public int SendTimeout { get; set; }
member this.SendTimeout : int with get, set
Public Property SendTimeout As Integer

プロパティ値

ミリ秒単位の送信タイムアウト値。 既定値は 0 です。

次のコード例では、 値を設定して取得します SendTimeout

// sets the send time out using the SendTimeout public property.
tcpClient->SendTimeout = 5;

// gets the send time out using the SendTimeout public property.
if ( tcpClient->SendTimeout == 5 )
      Console::WriteLine( "The send time out limit was successfully set {0}", tcpClient->SendTimeout );
// sets the send time out using the SendTimeout public property.
tcpClient.SendTimeout = 5;

// gets the send time out using the SendTimeout public property.
if (tcpClient.SendTimeout == 5)
    Console.WriteLine ("The send time out limit was successfully set " + tcpClient.SendTimeout.ToString ());
' Sets the send time out using the SendTimeout public property.
tcpClient.SendTimeout = 5000

' Gets the send time out using the SendTimeout public property.
If tcpClient.SendTimeout = 5000 Then
   Console.WriteLine(("The send time out limit was successfully set " + tcpClient.SendTimeout.ToString()))
End If

注釈

プロパティは SendTimeout 、正常に戻るまでメソッドが Send ブロックする時間を決定します。 この時間はミリ秒単位で測定されます。

メソッドを Write 呼び出すと、基になる Socket はホストに実際に送信されたバイト数を返します。 プロパティは SendTimeout 、 が返されたバイト数を TcpClient 受け取るまでに 待機する時間を決定します。 メソッドが正常に完了する前にタイムアウトが Send 切れた場合、 TcpClient は を SocketExceptionスローします。 既定ではタイムアウトはありません。

適用対象

こちらもご覧ください