in reply to Threading Client-Server (IO::Socket)
Hi Jonny,
I have been working on exactly this problem lately and got a massive amount of help from BrowserUk++. Please see multithreaded tcp listener with IO::Socket for the discussion and some excellent code Re^7: multithreaded tcp listener with IO::Socket.
For my problem I have an architecture like this ...
1 main/listener Thread listens for connections passes socket via queue cleans up old sockets Pool of receiver threads check data and send OK or ERROR to client, instruction to close socket back to main thread and puts ref to data on another queue for... Router thread Pulls refs off the queue and decides which of several handler threads will get it (may be one of more). spawns handler if it is not yet running then puts ref on queue for that handler. Handler threads do thing like logging, hearbeat monitoring forwarding exceptions to a console etc etc. Self Heartbeat Thread Send periodic heartbeats through its own mechanism to another monitor console so we know it is still working
Cheers,
R.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Threading Client-Server (IO::Socket)
by bloonix (Monk) on May 30, 2006 at 19:01 UTC | |
by Random_Walk (Prior) on May 31, 2006 at 21:18 UTC |