If you have opened the socket in Block mode then make it as O_NONBLOCK mode open.
Also, you can use Poll
If you need more information on this, post your code also, so that it will be easier for us to help.