in reply to Re: non-blocking listen on a tcp server
in thread non-blocking listen on a tcp server

I'd avoid this route. Basically, it involves implementing a limited form of cooperative multitasking from scratch. Here are some examples:

Example with sentinel ("\n") terminated messages
Example with length-prefixed messages

Update: I've added replies to the examples linked above that show simpler alternatives to using select.

Replies are listed 'Best First'.
Re^3: non-blocking listen on a tcp server
by monkeyfish (Initiate) on Jun 09, 2010 at 22:57 UTC
    Thanks alot folks. You're giving me good ideas.

    ikegami, I like the Coro option - the code is neat. I'm still trying to get my head around it though.

    The example doesn't appear to have the forking server but I need my server to handle multiple client connection simultaneously.

    Is that still an option when using Coro?
      forks also provides async, but forks instead of creating threads.