in reply to About non-blocking sockets

You should look into POE, it will be only a few lines of code with it.