[zeromq-dev] ZMQException: Errno 48 : Address already in use

曾纪川 zengjichuan at outlook.com
Wed Sep 10 07:39:00 CEST 2014

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 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140910/3e8d4b88/attachment.htm>

More information about the zeromq-dev mailing list