Share via


TcpClient.ReceiveTimeout Özellik

Tanım

Okuma işlemi başlatıldıktan sonra bir TcpClient veri almak için bekleyeceği süreyi alır veya ayarlar.

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

Özellik Değeri

Bağlantının milisaniye cinsinden zaman aşımı değeri. Varsayılan değer 0’dır.

Örnekler

Aşağıdaki kod örneği, alma zaman aşımını ayarlar ve alır.

// Sets the receive time out using the ReceiveTimeout public property.
tcpClient->ReceiveTimeout = 5;

// Gets the receive time out using the ReceiveTimeout public property.
if ( tcpClient->ReceiveTimeout == 5 )
      Console::WriteLine( "The receive time out limit was successfully set {0}", tcpClient->ReceiveTimeout );
// Sets the receive time out using the ReceiveTimeout public property.
tcpClient.ReceiveTimeout = 5000;

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

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

Açıklamalar

özelliği, ReceiveTimeout yöntemin veri alıncaya kadar ne kadar süreyle Read engelleneceğini belirler. Bu süre milisaniye cinsinden ölçülür. Zaman aşımı başarıyla tamamlanmadan önce Read sona eriyorsa, TcpClient bir IOExceptionoluşturur. Varsayılan olarak zaman aşımı yoktur.

Şunlara uygulanır

Ayrıca bkz.