Share via


Available Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets the amount of data that has been received from the network and is available to be read.

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

Syntax

'Declaration
Public ReadOnly Property Available As Integer
public int Available { get; }
public:
property int Available {
    int get ();
}
member Available : int with get
function get Available () : int

Property Value

Type: System. . :: . .Int32
The number of bytes of data received from the network and available to be read.

Remarks

If you are using a non-blocking Socket, Available is a good way to determine whether data is queued for reading, before calling Receive. The available data is the total amount of data queued in the network buffer for reading. If no data is queued in the network buffer, Available returns 0.

If the remote host shuts down or closes the connection, Available can throw a SocketException. If you receive a SocketException, use the SocketException..::..ErrorCode property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error.

.NET Framework Security

See Also

Reference

Socket Class

System.Net.Sockets Namespace