Method _Stdio.Fd()->poke()


Method poke

int(-1..1) poke()
int(-1..1) poke(int|float timeout)
int(-1..1) poke(int|float timeout)

Description

Check if there is buffer space available to write data, or wait some time for available space.

More specifically, a later nonblocking call to write() will succeed in writing some data, or indicate some error (eg if a nonblocking socket failed to connect).

Parameter timeout

Timeout in seconds.

Returns
1

There is buffer space available, or nonblocking connect() has completed.

0

There is no data available (ie timeout), or the call was interrupted by a signal.

-1

Error condition. The error code returned by errno() has been updated (eg a nonblocking connect() has failed).

See also

errno(), connect(), write(), peek()

Note

The function may be interrupted prematurely of the timeout (due to signals); check the timing manually if this is imporant.