def load(self, filename): fd = open(filename, 'r') if self.msg: self.destroy() msg = zmsg.load(ffi.NULL, ffi.cast("FILE *", filename)) if msg is not ffi.NULL: self.msg = msg fd.close()
def shadow_pyzmq_ctx(pyzmqctx): """ Create a new context by shadowing a pyzmq context """ address = pyzmqctx.underlying return shadow_zmq_ctx(ffi.cast('void *', address))
def save(self, filename): fd = open(filename, 'w') rc = zmsg.save(self.msg, ffi.cast("FILE *", filename)) if rc != 0: print("Error saving msg to file") fd.close()
def shadow_pyzmq_socket(pyzmq_socket): """ Get the underlying socket from a pyzmq Socket """ return ffi.cast("void *", pyzmq_socket.underlying)