[zeromq-dev] Code-style question

Pieter Hintjens ph at imatix.com
Tue May 22 20:54:57 CEST 2012


Marco,

Please read the Guide, it has examples that show how to create and
work with protocols like this.

-
Pieter

On Tue, May 22, 2012 at 1:11 PM, Marco Trapanese
<marcotrapanese at gmail.com> wrote:
> Hello,
>
> currently I'm using zmq on several projects to control remote
> applications. In fact, I send 'commands' rather 'data'.
>
> The architecture of the whole software is pretty simple. There are the
> basic functions that do the hard job (my own API). Let's call 'em
> func1(), func2() ...
>
> Then I wrote a raw protocol to call these functions through the zmq
> connection. After a message is received, I check the first part to
> decode the command and the followings to get the parameters (if any).
> Something like this:
>
> void parseMessage() {
>        // receive the message, get cmd, argc and argv[]
>
>        switch (cmd) {
>        case CMD1:
>                func1();
>                break;
>
>        case CMD2:
>                if (argc == 1) func2(argv[0]);
>                break;
>        }
> }
>
>
> I wonder how do you implement such an interface. Do you use a method
> like this or there is something more flexible/elegant?
>
> Thanks
> Marco
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list