NetworkStream::Close Method (Int32)
.NET Framework (current version)
Closes the NetworkStream after waiting the specified time to allow data to be sent.
Assembly: System (in System.dll)
Parameters
- timeout
-
Type:
System::Int32
A 32-bit signed integer that specifies the number of milliseconds to wait to send any remaining data before closing.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The timeout parameter is less than -1. |
The Close method frees both unmanaged and managed resources associated with the NetworkStream. If the NetworkStream owns the underlying Socket, it is closed as well.
If a NetworkStream was associated with a TcpClient, the Close method will close the TCP connection, but not dispose of the associated TcpClient.
.NET Framework
Available since 2.0
Available since 2.0
Show: