[zeromq-dev] Designing a new architecture

andrea crotti andrea.crotti.0 at gmail.com
Tue Aug 7 15:19:53 CEST 2012

2012/8/3 andrea crotti <andrea.crotti.0 at gmail.com>:
> So far I haven't found much more in the InteractiveClass to help me
> putting zeromq and cliff together actually:
> class cliff.interactive.InteractiveApp(parent_app, command_manager,
> stdin, stdout)
> it still takes a stdin and stdout objects, so it expects files..
> Instead of making a zeromq object behave like a file we could make it
> write and read from a file which is written and read by different
> processes, could that be a solution?

Since I am stubborn I was still trying to get the stdin/stdout
emulation with something like:

class ZmqStdin:
    """Fake a stdin file,
    def __init__(self):
        context = zmq.Context()
        self.socket = context.socket(zmq.PULL)

    def read(self):
        msg = self.socket.recv()
        # should I replace also the others?
        return msg

    readline = read

class ZmqStdout:
    def __init__(self):
        context = zmq.Context()
        self.socket = context.socket(zmq.PUSH)

    def write(self, msg):

    writeline = write

but then I finally realised that it doesn't make sense to run a cmd
loop on a remote process, also because I still would not get
completion and other nice things.

So what I will do (much simpler) is to leave stdin/stdout as they are
and pass the needed things to the cmd2 class to be able to query the
remote processes itself..

More information about the zeromq-dev mailing list