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 제한 시간이 만료되면 는 을 SocketExceptionthrow합니다TcpClient. 기본적으로 시간 제한은 없습니다.

적용 대상

추가 정보