in reply to How do I do a non-blocking accept?

I come across the same problem recently while working with windows,and i found a solution for that. I just know that there r diffrent ways of doing this,but what i don't know is which is the best one. My solution is here: suppose your accept() is in main thread then definitely it would block, so create a worker thread and put the accept in that worker thread,so here we go process never hangs or goes on a indefinite wait... The reason it work ,may be like this: a thread has to return to main thread, if it continues to be in suspended state for some finite state ( It is the OS Windows magic, we don't know what it does inside ???) so keep track of a global variable,if accept() succeeds in the worker thread then tune it, use the same in the main thread to check out the status of the accept() any reply is welcome ---------Fhani

Originally posted as a Categorized Answer.