C - Using poll to multiplex between socket(s) and stdin - Server
问题 I'm writing a client server application and I'm using poll to multiplex between several client sockets and stdin, where I can insert commands (example: stop the server). I believe the structure (the "logic") of my code is correct, however it's not behaving the way I expect it to: struct pollfd pfd[NSERVER]; //defined as 10 pfd[0].fd = fileno(stdin); pfd[0].events = POLLIN; pfd[1].fd = socktfd; //server bind, listen socket pfd[1].events = POLLIN; struct sockaddr_storage remoteaddr; // client