[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] IO::Multiplex, IO::Socket::INET




Wow.

    This is the coolest thing I have ever seen.

Earlier today I was staring down the barrel of several weeks (probably) of writing low-level Socket and select logic to facilitate an UltraMonkey load balancing implementation for work.

- Port 1: IO. Take inbound stream, break into work units, send each to a new TCP connection on port 2.
- Port 2: O
- Port 3: I. Take inbound streams (multiple sockets), flow all data to Port 1 outbound.

To get all that working w/o blocking was going to take a while. That's a big select() and a whole bunch of loops...

Then I found IO::Multiplex and IO::Socket::INET.

Check out the IO::Multiplex POD

   http://search.cpan.org/~bbb/IO-Multiplex-1.08/lib/IO/Multiplex.pm

Copy and paste the 2nd example ("simple chat server") and in 20(?) lines of Perl you have a multiple-connection chat server. Unreal.

This is going to make my job way too easy (I hope).

A big kudos to the authors! Wow.

j
Omaha Perl Mongers: http://omaha.pm.org