ICI Modules: net: select


Modules by name : by type

Synopsis

set | struct = net.select(set [, set] [, set] [, int])

Description

Determines the set of sockets marked as ready for I/O by the system and returns a set or collection of sets as determined by the arguments. The call may either block the program until I/O is ready, poll the state of the sockets or time out after some time period.

All set arguments are sets of sockets to be tested for readiness. Any non-socket objects in the sets will result in an error being raised.

The arguments are interpretered as follows. The first set argument is tested for being read readiness, the second set, if given, for write readiness and the third set, also if given, for exception readiness.

An integer argument is a time value. If zero the call polls the state of the sockets in the sets otherwise it is a count in microseconds of how long the call should wait before returning.

The result is either a set or struct according to how many set arguments were passed. If a single set argument is passed, to test for reading of sockets, then the result is a set, the set of sockets that are ready, which will be empty if no sockets are ready or the call timed out. If more than one set parameter is passed the result is a struct which contains three sets with the keys "read", "write", "exceptions" containing the ready sockets from each corresponding input set. The struct also contains an integer "n" that defines the total count of ready sockets.