System.Net.Sockets.NetworkStream.Close Method

Closes the System.Net.Sockets.NetworkStream after waiting the specified time to allow data to be sent.

Syntax

public void Close (int timeout)

Parameters

timeout
A 32-bit signed integer that specifies the number of milliseconds to wait to send any remaining data before closing.

Remarks

The NetworkStream.Close(int) method frees both unmanaged and managed resources associated with the System.Net.Sockets.NetworkStream. If the System.Net.Sockets.NetworkStream owns the underlying System.Net.Sockets.Socket, it is closed as well.

If a System.Net.Sockets.NetworkStream was associated with a System.Net.Sockets.TcpClient, the NetworkStream.Close(int) method will close the TCP connection, but not dispose of the associated System.Net.Sockets.TcpClient.

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0