[zeromq-dev] pyzmq -> pyczmq rewrite

Michael Haberler mail17 at mah.priv.at
Mon Nov 18 09:16:02 CET 2013

Hi Michel,

Am 18.11.2013 um 04:52 schrieb Michel Pelletier <pelletier.michel at gmail.com>:

> This uses ctypes.Structure.from_buffer to copy objects to and from an mmaped file with no serialization, in theory the only serializing happens "out of process" by the kernel to and from the mapped file.  Maybe some ideas here might help?

well, it was all in place anyway - it turns out that using zframe.data(f) is sufficient because this supports enough of the buffer protocol to work:

 f = zframe.recv(socket)

the sending side just becomes:

 zframe.send(zframe.new(self.tx.SerializeToString()), socket, 0)


re keyboard interrupt: I solved this by testing for  zpoller.terminated(poller) in the inner loop which I prefer anyway since it's synchronous delivery.

I think what warrants some thought longer term: if errors from pyczmq calls should raise exceptions or not. It's a very C-ish interface which requires a lot of asserts around calls.

- Michael

More information about the zeromq-dev mailing list