On 30 June 2010 20:30, Jens Mehnert <[email protected]> wrote: > Hello Steve, thanks for the quick answer. What about my other problem. > Isn't it possible to bind /connect a sender/receiver > to two different sockets on the same interface like this: > > private static final ZMQ.Context CONTEXT = ZMQ.context (1); > private static final ZMQ.Socket PRODUCER_SOCKET = CONTEXT.socket(ZMQ.PUB); > private static final ZMQ.Socket CONSUMER_SOCKET = CONTEXT.socket(ZMQ.SUB); > ... > > PRODUCER_SOCKET.bind("tcp://127.0.0.1:5555"); > > CONSUMER_SOCKET.setsockopt(ZMQ.SUBSCRIBE, ""); > CONSUMER_SOCKET.connect("tcp://127.0.0.1:5555"); > ... > > Producer Thread: > > while(!Thread.currentThread().interrupted()) { > try { > String value = TinyUUID.randomTinyUUID().toString(); > LOG.debug("Send " + value); > PRODUCER_SOCKET.send(value.getBytes(), 0); > Thread.sleep(1000); > } catch (Exception e) { > throw new RuntimeException(e); > } > } > > Consumer Thread (Runnable scheduled via ExecutorService): > > > while (!Thread.currentThread().isInterrupted()) { > try { > LOG.debug("Receiving ..."); > > byte[] rawMessage = CONSUMER_SOCKET.recv(0); > LOG.debug("Received %s", new String(rawMessage)); > > } catch (Exception e) { > LOG.error("An error occured handling zmq message ..."); > } > } > > The problem is that the send thread using the producer socket blocks on > send. If I don't > start the consumer send() does not block. Furthermore, If I use the two > different VMs ( > one producer, one consumer main app) it works splendidly too. > > What am I doing wrong? > > Best regards, Jens > >
Bump, I answered the PGM part, no idea about the ZMQ part. Hopefully someone else answers. -- Steve-o
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
