in reply to Re: Forking Clients
in thread Forking Clients
Hi first, thanks for your reply, but I have a few questions.
use strict; use threads; use Thread::Queue; use ClarRPC; my $queue = new Thread::Queue; rpc('10.15.51.208', '1300', 'ping -n 50 10.15.51.208'); rpc('10.15.51.208', '1301', 'ping -n 10 10.15.51.208'); rpc('10.15.51.208', '1302', 'ping -n 50 10.15.51.208'); while (my $ref = $queue->dequeue) { my ($port, @results) = @$ref; print "$port : @results\n"; } sub rpc { my ($ip, $port, $command) = @_; async{ my $connection = ClarRPC->connect($ip, $port); my @resp :shared = $connection->rpc('ClarRPCService::system_ca +ll', $command); $connection->disconnect(); unshift(@resp, $port); $queue->enqueue(\@resp, undef); }->detach }
So in this case note the 1301 port command is a -n 10, so this one will return prior to the others. So what I see in this instance is that the program exits, as soon as the 1301 port returns its info. What I was hoping for was for something that wouldn't exit until they were all done. I don't see anything glaring that I missed in my version which would make it different than yours in functionality.
Any ideas? Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Forking Clients
by BrowserUk (Patriarch) on Oct 15, 2008 at 17:32 UTC | |
by gepapa (Acolyte) on Oct 15, 2008 at 17:55 UTC | |
by BrowserUk (Patriarch) on Oct 15, 2008 at 18:31 UTC | |
by gepapa (Acolyte) on Oct 15, 2008 at 19:05 UTC | |
by BrowserUk (Patriarch) on Oct 15, 2008 at 23:04 UTC | |
| |
by mr_mischief (Monsignor) on Oct 15, 2008 at 21:05 UTC | |
|