- Method peek
int(-1..1) peek(int|float timeout)
int(-1..1) peek(int|float timeout, int not_eof)
Check if there is data available to read, or wait some time for available data to read.
More specifically, a later call to read() will return immediately, either due to data being present, or due to some error (eg if a socket has been closed).
- Parameter timeout
Timeout in seconds.
- Parameter not_eof
Flag for specifying handling of end of file. The following values are currently defined:
Traditional (and default) behaviour. Return
Regard EOF as an error. Return
-1and set errno() to return
There is no data available (ie timeout).
Error condition. The error code returned by errno() has been updated.
- See also
The function may be interrupted prematurely of the timeout (due to signals); check the timing manually if this is imporant.
The not_eof parameter was added in Pike 7.7.
This function was not available on NT in Pike 7.6 and earlier.