I'm trying to write a multithreaded application where 1 thread monitors a queue and send the messages in the queue (if there are any) and 1 thread looks for incoming messages and handles them... The first part I have done and is working, the second part (incoming messages) I can't get to work.

Is there a sockets function that gets triggered or wait for incoming data? If not, do I just have to put a read in an endless loop or so?

Thanks,
Chig.