HPlogo HP 9000 Networking: BSD Sockets Interface Programmer's Guide > Chapter 5 Advanced Topics for Internet Datagram Sockets

Synchronous I/O Multiplexing with Select

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

The select system call can be used with sockets to provide a synchronous multiplexing mechanism. The system call has several parameters which govern its behavior. If you specify a zero pointer for the timeout parameter timout, select will block until one or more of the specified socket descriptors is ready. If timout is a non-zero pointer, it specifies a maximum interval to wait for the selection to complete.

select is useful for datagram socket descriptors to determine when data have arrived and are ready to be read without blocking; use the FIONREAD parameter to the ioctl system call to determine exactly how much data are available.

select for exceptional conditions will return true for BSD sockets if out-of- band data is available. select will always return true for sockets which are no longer capable of being used (e.g. if a close or shutdown system call has been executed against them).

select is used in the same way as in other applications. Refer to the select(2) man page for information on how to use select.

© 1997 Hewlett-Packard Development Company, L.P.