Skip to content

Instantly share code, notes, and snippets.

@mythosil
Created July 30, 2011 03:32
Show Gist options
  • Save mythosil/1115163 to your computer and use it in GitHub Desktop.
Save mythosil/1115163 to your computer and use it in GitHub Desktop.
tcp client using zeromq
use strict;
use warnings;
use ZeroMQ qw/:all/;
use Data::Dumper;
my $peer_addr = 'tcp://127.0.0.1:1986';
my $context = ZeroMQ::Context->new;
my $sock = $context->socket(ZMQ_REQ);
$sock->connect($peer_addr);
while (<>) {
chomp;
my $msg = ZeroMQ::Message->new($_);
$sock->send($msg);
$msg = $sock->recv;
print $msg->data, "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment