in reply to Re^2: Problem handling 2 simultaneous socket streams
in thread Problem handling 2 simultaneous socket streams
See Re: Ask for STDIN but don't pause for it and the last example. This is untested in your code, but something like this will work. Just add \*STDIN to your Select object and test for it.
# Add listen sockets to select my $sockets = new IO::Select(); $sockets->add(\*STDIN ); $sockets->add($stream1_lsn); $sockets->add($client1_lsn); $sockets->add($client2_lsn); ..... #Go into infinite loop, handling connections - how do I end this? while(my @ready = $sockets->can_read) { #got data foreach my $socket (@ready) { # find which socket sent data if ($socket == \*STDIN) { #read stdin and detect a q; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Problem handling 2 simultaneous socket streams
by PhillyR (Acolyte) on Sep 29, 2011 at 19:04 UTC | |
by zentara (Cardinal) on Sep 30, 2011 at 10:55 UTC | |
by PhillyR (Acolyte) on Oct 04, 2011 at 16:37 UTC | |
by zentara (Cardinal) on Oct 04, 2011 at 16:46 UTC | |
by PhillyR (Acolyte) on Oct 04, 2011 at 18:17 UTC | |
|