Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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


In reply to Re^2: Forking Clients by gepapa
in thread Forking Clients by gepapa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2023-02-04 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (30 votes). Check out past polls.

    Notices?