![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Listening on multiple ports using IO::Selectby JPaul (Hermit) |
on Mar 19, 2003 at 16:59 UTC ( #244382=perlquestion: print w/replies, xml ) | Need Help?? |
JPaul has asked for the wisdom of the Perl Monks concerning the following question:
Greetings monks; I'm trying to get a non-forking perl TCP server (at its simplest) to listen to multiple local ports bound to the same address and am having a time making it work. What I'm doing appears logical... but just doesn't want to do its thing. I use IO::Select to watch the first port, and figured it'd be as simple as add()ing another server handle to the Select handle's list... apparently not. The below code produces a working server on port 5000, however when I connect to port 5050 the script terminates with a 'Broken pipe' error, closing the telnet connection rather impolitely. If I switch the Select->new statement, I get the same results, so I know its not in the way I add the handle to the Select. ie: What fundamental fact am I missing here that prevents this from working like I want it to? (Sounds suspiciously like "Do what I want, not what I say") Thanks all;
JP,
Back to
Seekers of Perl Wisdom
|
|