The multiplexing function you are looking for (and is found in the above tutorials) is "select()". It takes arguments including sets of socket file descriptors, and tells you which of those has data that can be read without blocking the program flow.
|