Using select() system call for listening on stdin and the server
问题 I want to use select system call to multiplex STDIN and SOCKFD (connected to a server) such that I must be listening to both STDIN and SOCKFD and depending upon where the data is available for read I must proceed further. Note: #define STDIN 0 This is what happens when I do the following. I connect to the server the usual way [ socket() then connect() ] I add STDIN and connection socket descriptor 'SOCKFD' to the fd_set (named 'readset') meant for reading. Then I call select(). Use FD_ISSET