in reply to Forking Clients
If you don't have an irrational fear of threads, something like this complicated beast would do it :):
#! perl -slw use strict; use threads; use threads::shared; use Thread::Queue; use ClarRPC; #In house module my $Q = new Thread::Queue; my $ip = '10.15.51.208'; my $command = 'ping -n 15 10.15.51.208'; my @ports = 1300 .. 1302; for my $port ( @ports ) { async{ my $connection = ClarRPC->connect( $ip, $port ); my @results :shared = $connection->rpc( 'ClarRPCService::system_call', $command ); $connection->disconnect(); unshift @results, $port; $Q->enqueue( \@results, undef ); }->detach; } for ( 1 .. @ports ) { while( my $ref = $Q->dequeue ) { my( $port, @results ) = @$ref; print "$port : @results"; } } __END__ c:\test>junk4 1300 : 1 2 3 4 5 6 7 8 9 10 1301 : 1 2 3 4 5 6 7 8 9 10 1302 : 1 2 3 4 5 6 7 8 9 10
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Forking Clients
by gepapa (Acolyte) on Oct 15, 2008 at 17:27 UTC | |
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 | |
|