Atom

net.poll()

Checks accept or read readiness.

Signature

net.poll(socket[, timeout])

Parameters

Open socket plus optional duration or null, default zero.

Returns

Boolean. EOF on TCP counts as ready.

Behavior

Can read and cache data for the next read without exposing it yet.

Errors

Unexpected I/O failure or invalid socket. Timeout/would-block returns false.

Example

Atom
use net
s = net.bind('127.0.0.1', 0)
assert(not net.poll(s))
net.close(s)