[zeromq-dev] jzmq router socket unable to bind to address

Pieter Hintjens ph at imatix.com
Sun Nov 3 00:04:55 CET 2013


If a zmq API call fails, you can debug that by checking the
zmq_errno() value, or zmq_strerror () to print an error reason.

On Sat, Nov 2, 2013 at 11:04 PM,  <starkdg at comcast.net> wrote:
> Hello folks,
>
> I have been updating some code to use the newer
> zeromq 3.2 library (from the legacy 2.2 version).  However,
> it runs into a run-time error when trying to bind a router socket
> to an address.  I have reduced the problem to the code below.
>
> Beforehand, It was using a pair of  XREP/XREQ sockets in a queue device,
> feeding it to several
> worker threads, each with a REP socket.  (The client app used a REQ socket.)
> This seemed
> to work fine, but I read in the guide about the ROUTER/DEALER proxy
> functionality, so I've
> been trying to replicate that.  The code below compiles fine.  Why does it
> fail when binding to the
> address?
>
> The following describes where it fails:
>
> Problematic frame:
> # C  [libzmq.so.3+0x27c90]  zmq::signaler_t::signaler_t()+0x80
>
> Thanks for your help.
> David Starkweather
>
>
> import org.zeromq.ZContext;
> import org.zeromq.ZMQ;
> import org.zeromq.ZMQ.Socket;
> import org.zeromq.ZMQQueue;
>
> public class TestJZMQ {
>
>     public static void main(String[] args){
>
> String addr = "tcp://*:4005";
> String inprocaddr = "inproc://link";
>
> // setup messaging
> ZContext zmqctx = new ZContext();
> zmqctx.setIoThreads(1);
>
> System.out.println("Create front socket");
> Socket frontSocket = zmqctx.createSocket(ZMQ.ROUTER);
>
> System.out.println("Bind to " + addr);
> frontSocket.bind(addr);
>
> System.out.println("Create back socket");
> Socket backSocket = zmqctx.createSocket(ZMQ.DEALER);
>
> System.out.println("bind to " + inprocaddr);
> backSocket.bind(inprocaddr);
>
> ZMQ.proxy(frontSocket, backSocket, null);
>     }
> }
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 
-
Pieter Hintjens
CEO of iMatix.com
Founder of ZeroMQ community
blog: http://hintjens.com



More information about the zeromq-dev mailing list