available

Synopsis

$ available([$handle])

Obtain the number of bytes that can be read from handle without blocking.

$ available($handle, "delim")

Read ahead in the handle to see if the delimeter is present in the buffer or not.

Parameters

$handle - the handle to check. if no handle is specified the console will be used.

"delim" - the delimeter to search for.

Returns

In the first usage, the number of bytes readable from the handle without blocking. In the second case $null is returned if the delimeter is not found. Otherwise the position of the delimeter is returned.

Side Effects / Notes

Examples

$handle = connect("www.yahoo.com", 80); println($handle, "GET /"); sleep(3000); println(available($handle) . " bytes are available");

9562 bytes are available

See Also