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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.