Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

TcpClient::ReceiveTimeout Property

 

Gets or sets the amount of time a TcpClient will wait to receive data once a read operation is initiated.

Namespace:   System.Net.Sockets
Assembly:  System (in System.dll)

public:
property int ReceiveTimeout {
	int get();
	void set(int value);
}

Property Value

Type: System::Int32

The time-out value of the connection in milliseconds. The default value is 0.

The ReceiveTimeout property determines the amount of time that the Read method will block until it is able to receive data. This time is measured in milliseconds. If the time-out expires before Read successfully completes, TcpClient throws a IOException. There is no time-out by default.

The following code example sets and gets the receive time out.

// 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 );


.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft