Clarification on usage of select() in C/C++ App
Hi all,
I found two documents that explains the usage of select():
1. doc 1: "The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O."
2. doc 2:
"The select() function supports regular files, terminal and pseudo-terminal devices, STREAMS-based files, FIFOs and pipes. The behaviour of select() on file descriptors that refer to other types of file is unspecified."
I am confused, is select() supposed to be used for sockets only, or used for all I/O devices??
If used for all I/O devices, where/how does one specify the device of interest. Thanks.
Like all unix I/O a socket is indistinguishable from a file. So, anything that has a file descriptor (sockets included ) can be used with select().
Edit: that is for unix only.
On windows select is a call to the wsock library, and can only be used on sockets.
Edit: that is for unix only.
On windows select is a call to the wsock library, and can only be used on sockets.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement