[zeromq-dev] Fwd: Beginner question with respect to zmq_proxy

Nishant Mittal nmittal at rblt.com
Wed Dec 26 21:26:14 CET 2012


Hi All,
I have a zmq_proxy device with ROUTER and DEALER in the front and back
(attached code broker.c)
router binds to tcp://*:5551 and dealer binds to tcp://*:6551
the client connects to router with a REQ socket as tcp://nishant:5551 and
worker connects to dealer with a REP socket as tcp://nishant:6551 where
nishant is the hostname of the machine..

the above works fine

however, if I move the client to another machine.. the worker sees the
request but the client doesn't get any response.. what am I doing wrong?

thanks in advance for your help.

-- 
*Nishant Mittal*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121226/edaf7b42/attachment.htm>
-------------- next part --------------
#!/usr/bin/perl -w

use strict;
use warnings;
use Data::Dumper;
use ZMQ::LibZMQ3;
use ZMQ::Constants qw(:all);

my $ctxt = zmq_init;
my $socket = zmq_socket( $ctxt, ZMQ_REQ );

zmq_connect( $socket, "tcp://nishant:5551" );

zmq_send( $socket, "Test");	

my $msg = zmq_recvmsg( $socket );
my $data = zmq_msg_data( $msg );
print Dumper $data;

zmq_close($socket);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: broker.cpp
Type: text/x-c++src
Size: 1411 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121226/edaf7b42/attachment.cpp>
-------------- next part --------------
#!/usr/bin/perl -w

use strict;
use warnings;
use Data::Dumper;
use ZMQ::LibZMQ3;
use ZMQ::Constants qw(:all);

my $ctxt = zmq_init;
my $socket = zmq_socket( $ctxt, ZMQ_REP );

zmq_connect( $socket, "tcp://nishant:6551" );

my $msg;

while($msg = zmq_recvmsg( $socket )){
	my $data = zmq_msg_data( $msg );
	print Dumper $msg;
	
	zmq_send( $socket, "RESPONSE: $data");		
}

zmq_close($socket);



More information about the zeromq-dev mailing list