System.Net.Sockets.NetworkStream.DataAvailable Property

Gets a value that indicates whether data is available on the System.Net.Sockets.NetworkStream to be read.

Syntax

public virtual bool DataAvailable { get; }

Value

true indicates that data is available to be read; false indicates that there is no data available to be read.

Exceptions

TypeReason
ObjectDisposedExceptionThe current instance has been disposed.

Remarks

Use the NetworkStream.DataAvailable property to determine if data is ready to be read. If NetworkStream.DataAvailable is true, a call to NetworkStream.Read(Byte[], int, int) returns immediately. If the remote host shuts down or closes the connection, NetworkStream.DataAvailable may throw a System.Net.Sockets.SocketException.

Requirements

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