On Tue, Aug 20, 2013 at 11:39 AM, Dirkjan Ochtman <dirkjan@xxxxxxxxxx> wrote: > I'm working on a cffi-based Python binding, but I'm stuck right now. I > have this code: > > import nnpy, time > > pub = nnpy.Socket(nnpy.AF_SP, nnpy.PUB) > pub.bind('inproc://foo') > print pub.getsockopt(nnpy.SOL_SOCKET, nnpy.DOMAIN) > > sub = nnpy.Socket(nnpy.AF_SP, nnpy.SUB) > sub.connect('inproc://foo') Try to subscribe to something. Maybe that's why you're not getting any data. > pub.send('FLUB') > print 'YEAH' > time.sleep(0.5) > print sub.recv() > > However, this seems to hang on the sub.recv() call. The socket class > is implemented in the simplest mapping to nn_* functions you could > imagine, here's what the recv() method looks like: > > def recv(self, flags=0): > buf = ffi.new('char[16384]') > rc = nanomsg.nn_recv(self.sock, buf, 16384, flags) > assert rc > 0, rc > print rc, buf > > So far, it prints YEAH and then just sits there. The send completes > correctly, returning 4. This happens with both the inproc and tcp > transports, on a modern Linux box. > > Any hints? > > Cheers, > > Dirkjan >