in reply to IO::Socket/multiple connections related

If I understand you correctly your problem is host B. You want to read 2 streams at the same time.

There are many solutions. The simplest is certainly a forking server. After accept()ing a new client the process calls fork(). The parent process closes the client connection and waits for the next client while the child handles the connection.

Another way is to use select() (or IO::Select) with nonblocking IO. There are many examples on the Internet I believe.

Then there are various event modules that do basically the same as select() but often more effectively. These come to mind: Event, Event::Lib, EV, POE, AnyEvent

Then there are perl's ithreads. (use threads;)

And in the end there is Coro. If I where you I'd go either with this one or code a forking server.

Torsten

  • Comment on Re: IO::Socket/multiple connections related