Share via


TcpClient.SendTimeout Özellik

Tanım

Bir gönderme işleminin başarıyla tamamlanmasını bekleyeceği süreyi TcpClient alır veya ayarlar.

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

Özellik Değeri

Milisaniye cinsinden gönderme zaman aşımı değeri. Varsayılan değer, 0'dur.

Örnekler

Aşağıdaki kod örneği değerini ayarlar ve alır 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

Açıklamalar

SendTimeout özelliği, başarılı bir şekilde geri dönene kadar yöntemin Send ne kadar süreyle engelleneceğini belirler. Bu süre milisaniye cinsinden ölçülür.

Yöntemini çağırdıktan Write sonra, temel alınan Socket , konağa gönderilen bayt sayısını döndürür. özelliği, SendTimeout döndürülen bayt sayısını almadan önce bir TcpClient öğesinin bekleyeceği süreyi belirler. Yöntem başarıyla tamamlanmadan önce Send zaman aşımı süresi dolarsa, TcpClient bir SocketExceptionoluşturur. Varsayılan olarak zaman aşımı yoktur.

Şunlara uygulanır

Ayrıca bkz.