[zeromq-dev] ZMQException: Errno 48 : Address already in use
曾纪川
zengjichuan at outlook.com
Wed Sep 10 08:22:28 CEST 2014
Thanks for the answer. If I use client.bind("ipc://yo:15545"); server will receive msg as expected. If not use bind, server cannot receive msg, but when I use client.bind("inproc://yo:15545"); the Errno 48 will raise. I need to set both sides' bind address, cause there are other DEALERs would connect to them.
Best Regards,Zeng Jichuan
Date: Tue, 9 Sep 2014 23:46:51 -0600
From: optionguy71 at gmail.com
To: zeromq-dev at lists.zeromq.org
Subject: Re: [zeromq-dev] ZMQException: Errno 48 : Address already in use
One side should bind, and the other should use connect.
On Sep 9, 2014 11:39 PM, "曾纪川" <zengjichuan at outlook.com> wrote:
I just start to learn ZMQ in java(jeromq-0.3.4, Ubuntu 14.10, java-1.8), I want to design a N:N connection network which suppose to be the model ROUTER-ROUTERThe problem is ROUTER will raise "Errno 48 : Address already in use" when I set both Routes' bind address to be "inproc", it willbe all right in both non-inproc addresses, or one side non-inproc addr. So how can I set both sides inproc addr and keep connection.
code list :
ZMQ.Socket server = ctx.createSocket(ZMQ.ROUTER); server.setIdentity(connectEndpoint.getBytes()); server.bind(bindEndpoint); System.out.printf ("I: service is ready at %s\n", bindEndpoint); ZMQ.Poller poller = new ZMQ.Poller(1); poller.register(new ZMQ.PollItem(server, ZMQ.Poller.POLLIN)); while (!Thread.currentThread().isInterrupted()) { ZMsg request = null; poller.poll(); if(poller.pollin(0)){ request = ZMsg.recvMsg(server); } if (request == null) break; // Interrupted System.out.println("Server received: "+request); } ZMQ.Socket client = ctx.createSocket(ZMQ.ROUTER); client.setIdentity("client1".getBytes()); client.bind("inproc://yo:15545"); //client.bind("ipc://yo:15545"); // it works client.connect(bindEndpoint); //errno ZMsg request = new ZMsg(); request.add(""); request.add("Client Message"); request.push(connectEndpoint); request.send(client);exception: Exception in thread "main" org.zeromq.ZMQException: Errno 48 : Address already in use at org.zeromq.ZMQ$Socket.mayRaise(ZMQ.java:1344) at org.zeromq.ZMQ$Socket.connect(ZMQ.java:1157) at TestId.main(TestId.java:54) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Best Regards,Zeng Jichuan
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140910/bbe1b9df/attachment.htm>
More information about the zeromq-dev
mailing list