[zeromq-dev] Problem with IPC

Oliver Smith oliver at kfs.org
Mon Jul 26 09:05:44 CEST 2010


If an UPSTREAM connects to an IPC socket that has already had data sent, 
it will not receive the first message sent after connection:

Given the following upstream:

[lua]
     require 'zmq' ; ctx = zmq.init(1) ; s = ctx:socket(zmq.UPSTREAM) ; 
s:connect("ipc:///tmp/zmqdemo")
     s:recv()

[python]
     import zmq ; ctx = zmq.Cotnext() ; s = ctx.socket(zmq.UPSTREAM) ; 
s.connect("ipc:///tmp/zmqdemo")
     s.recv()

If you now start a downstream in an interpreter

[lua]
     require 'zmq' ; ctx = zmq.init(1) ; s = ctx:socket(zmq.DOWNSTREAM) 
; s:bind("ipc:///tmp/zmqdemo")
     s:send("Hello")
     -- restart the upstream
     s:send("blah")
     -- wait a few moments
     s:send("World")

[python]
     import zmq ; ctx = zmq.Context() ; s = ctx.socket(zmq.DOWNSTREAM) ; 
s.bind("ipc:///tmp/zmqdemo")
     s.send("Hello")
     -- restart the upstream
     s.send("blah")
     -- wait a few moments
     s.send("World")


The second upstream won't see the "blah" message but it will see the 
"World" message.

Note: the "blah" is only being sent /after/ the first upstream has 
closed and the second upstream has connected.

Even adding an explicit s:close() / s.close() does not fix this.

- Oliver





More information about the zeromq-dev mailing list