Socket_Select - select()
In: R0 = Number of descriptors to consider in each set
R1 = Pointer to read descriptor set
R2 = Pointer to write descriptor set
R3 = Pointer to exception descriptor set
R4 = Pointer to timeout block
Out: R0 = Number of ready descriptors
This call polls a specified groups of sockets to see which are ready for reading, which are ready for writing and which had exceptional conditions pending.
Each of the three descriptor sets is a bitmask, where bit zero refers to socket zero, bit one to socket one and so on. Only those sockets whose bit is set in a mask will be considered when performing the checks. FreeNet currently supports 128 sockets, so the bitmasks are arrays of four words - descriptors 0 to 31 are in the first word and so on.
The value in R0 is the number of bits in the descriptor sets which should be considered as having meaning, so if R0 is 9 only the first 9 bits (descriptors 0 to 8) will be considered.
This call will return as soon as one or more of the sockets being tested is ready or when a timeout occurs. Passing a null pointer for the timeout means the call will never timeout, and will block until a socket is ready. The timeout takes the following form:
R4 + 0 = Number of seconds to wait
4 = Number of microseconds to wait
A timeout with both fields set to zero will cause the call to return immediately, regardless of how many sockets are ready.
|
|
|