JPaul has asked for the wisdom of the Perl Monks concerning the following question:
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.my $server = IO::Socket::INET->new(LocalPort => 5000, Listen => 10, Reuse => 1) or die "Can't make server socket: $@\n"; my $serverB = IO::Socket::INET->new(LocalPort => 5050, Listen => 10, Reuse => 1) or die "Can't make server socketB: $@\n"; my $select = IO::Select->new(($server, $serverB)); while (1) { foreach my $client ($select->can_read(1)) { if ($client == $server) { $client = $server->accept(); $select->add($client); print $client "Howdy\n"; } else { print $client "G'bye\n"; $select->remove($client); close($client); } } }
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")my $select = IO::Select->new(); $select->add($server); $select->add($serverB);
JP,
-- Alexander Widdlemouse undid his bellybutton and his bum dropped off --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Listening on multiple ports using IO::Select
by jasonk (Parson) on Mar 19, 2003 at 17:05 UTC | |
by JPaul (Hermit) on Mar 19, 2003 at 17:09 UTC | |
|
•Re: Listening on multiple ports using IO::Select
by merlyn (Sage) on Mar 22, 2003 at 16:06 UTC |