The read does not appear to be a non-blocking read on the socket - ie., it sits there and waits forever which explains why more than one client fails.
This will make the socket you are reading on non-blocking (POSIX code)
#include <fcntl.h>
/* fd = socket id */
int setNonblocking(int fd)
{
int flags;
if ((flags = fcntl(fd, F_GETFL, 0)) == (-1) )
{
flags = 0;
}
return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
} I would suggest reading at least chapter 5:
http://www.advancedlinuxprogramming.com/alp-folder
The ipc stuff is the same linux or not - it's all POSIX