AS
Size: a a a
AS
М
М
AS
SZ
Ii
М
my %conn;
#my @ports = (42002, 42003, 42004, 42005, 42006, 42007, 42008, 42009, 42010, 42011);
my @ports = (62111, 42002, 42003, 42004, 42005, 42006, 42007, 42008, 42021, 42022, 42023);
for my $port (@ports) {
#$conn{$port} = $ctx->socket(ZMQ_DEALER);
$conn{$port} = $ctx->socket(ZMQ_REQ);
$conn{$port}->die_on_error(1);
$conn{$port}->connect("tcp://127.0.0.1:$port");
# print $conn{$port}->has_error() . $conn{$port}->last_errno() . "\n";
my ($major, $minor, $patch) = $conn{$port}->version;
print " ($major, $minor, $patch)\n";
}
use EV;
my @handlers;
my @recv;
my $t = [gettimeofday];
for my $s (keys %conn) {
my $handler = EV::io $conn{$s}->get_fd, EV::READ, sub {
while ($conn{$s}->has_pollin) {
print Dumper(@_);
my $reply = $conn{$s}->recv();
print "got reply '$reply' from $s\n";
push @recv, $reply;
}
};
push(@handlers, $handler);
print "pushing to: $s\n";
$conn{$s}->send("get smth");
}
my $check_every = 1; # second
my $check = EV::periodic 0, $check_every, 0, sub {
if(@recv == @ports) {
EV::break(EV::BREAK_ALL);
}
};
EV::run;
М
М
М
М
Ii
М
М
VG
AS
SZ
М
М