I’m trying to write a server that handles multiple clients at a time. Apparently I’m supposed to use select. I’ve found numerous tutorials but none of them handle writing.
I get how I’m supposed to read data in, but what’s the.. appropriate way to handle writing back to the clients in my ‘loop’?
Thanks in advance.
If you have data that you want to send to a particular socket, then you need select() to return when there is space available in that socket’s output-buffer. The way to tell select() to do that is similar to using select() just for read — except that also you do the FD_SET on the second fd_set object.