socket_object.Available Property

Gets the number of data bytes currently available to receive from a Socket.

...socket_object.Available

Prerequisites

The Socket must be open and ready to receive data.

Parameters

None

Remarks

This property returns the number of bytes available on an open Socket. If this number is greater than zero, a Receive or ReceiveFrom method may be called to read data. Throws an Exception if the Socket is not open or an error occurs.

This method may be used to poll for data to read. A better solution is to set the ReceiveTimeout property for the Socket.

Examples

While ts.Available = 0    ' Test if anything to receive
Thread.Sleep(1000) ' Wait 1 second
End While
ts.Receive(recv, 1500) ' Receive the data

See Also

Networking Classes | socket_object.Blocking | socket_object.ReceiveTimeout