Export (0) Print
Expand All

NetworkStream.WriteTimeout Property

Gets or sets the amount of time that a write operation blocks waiting for data.

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

'Declaration
Public Overrides Property WriteTimeout As Integer

Property Value

Type: System.Int32
A Int32 that specifies the amount of time, in milliseconds, that will elapse before a write operation fails. The default value, Infinite, specifies that the write operation does not time out.

ExceptionCondition
ArgumentOutOfRangeException

The value specified is less than or equal to zero and is not Infinite.

If the write operation does not complete within the time specified by this property, the write operation throws a IOException.

NoteNote

This property affects only synchronous write operations performed by calling the Write method. This property does not affect asynchronous writes performed by calling the BeginWrite method.

The following code example sets the write time-out for a network stream to 10 milliseconds.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft