tcp_select(+Timeout, -Term)

This is the same as tcp_select/1 (see ipc-tcp-trm-select1), except tcp_select/2 will return the atom timeout if the timeout interval expires before input is available or before a timer alarm is delivered (from tcp_schedule_wakeup/2, see ipc-tcp-tim-schedule_wakeup2).

Timeout is a floating point number indicating seconds.

The tcp_select predicates must deal with three events:

  1. Timer alarms -- are dealt with first. These are scheduled with tcp_schedule_wakeup/2 (see ipc-tcp-tim-schedule_wakeup2).
  2. ready input -- are dealt with when (1) doesn't apply, that is, if no timer alarm is delivered; tcp_select/2 will sleep until there is input available from some connected process.
  3. timeout -- when neither (1) or (2) apply, and the timeout interval specified has expired, then the atom timeout is returned.

A poll is effected by specifying 0 for Timeout.