Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-02-02 Thread Thomas Rodgers
<> Is this correct? Yes > 1. What advantages do I have when using something like protocol buffer to > serialization data instead of > send the data of a basic way such as I perform here turn the data to > string and sending it? > If you want to send complex data structures, portably between

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-30 Thread Thomas Rodgers
You can’t memcpy a std::string, and in fact, you should t be using memcpy in general in C++. I won’t go into the why of all of that here, but start by changing - memcpy(request.data(), **, 30); To memcpy(request.data(), *result.c_str()*, result.size() + 1); On Tue, Jan 30, 2018 at 4:46 PM

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-30 Thread Bernardo Augusto García Loaiza
Hi, I again. I've performed some small test in relation to the way on how to I sending the data member structure. I am turning the int data member structure to string before to be send it .. In the following code section I am turn btnState in string data and assign it to string s variable and I

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-27 Thread Thomas Rodgers
“strat team” was supposed to be std::stringstream (Thanks for nothing autocorrect!) http://en.cppreference.com/w/cpp/io/basic_stringstream On Sat, Jan 27, 2018 at 10:22 AM Thomas Rodgers wrote: > Strings are the simplest. If you don’t need to parse the data on the C++ >

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-27 Thread Thomas Rodgers
Strings are the simplest. If you don’t need to parse the data on the C++ side, just format it as a JSON map on the C++ side, stream it into a strat team, send the resulting string on the socket and use Python’s support for parsing JSON on the received strong. For instance. You can also send

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-27 Thread Bernardo Augusto García Loaiza
Hi Luca, this mean, then, with structured string or data is necessary some middleware entity like GPB such as Thomas tell us ... Bernardo Augusto García Loaiza Ingeniero de Sistemas Estudiante de Maestría en Ingeniería Informática - Universidad EAFIT http://about.me/bgarcial On Sat, Jan 27,

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-27 Thread Luca Boccassi
Yes you can just send unstructured binary data or strings - Python has native helpers for strings, and CZMQ as well On Fri, 2018-01-26 at 21:27 -0500, Bernardo Augusto García Loaiza wrote: > Thomas, I understand perfectly your explanation. But I want share > with you > another similar case, just

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-26 Thread Bernardo Augusto García Loaiza
Thomas, I understand perfectly your explanation. But I want share with you another similar case, just for curiosity or to receive some additional orientation about it. I have a script client C++ ZEROMQ as a documentation, and I have script server python, together based in the documentation

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-26 Thread Bernardo Augusto García Loaiza
Thanks Thomas. Best Regards :) On Fri, Jan 26, 2018 at 7:44 AM Thomas Rodgers wrote: > Short answer yes, it’s related to different languages. TCP and ZeroMQ only > deal with transport and framing of messages (respectively) Python has no > idea that that 10 bytes

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-26 Thread Thomas Rodgers
Short answer yes, it’s related to different languages. TCP and ZeroMQ only deal with transport and framing of messages (respectively) Python has no idea that that 10 bytes corresponds to a C/C++ struct of a given layout until you tell it. Different platforms (CPU architectures) have potentially

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-25 Thread Bernardo Augusto García Loaiza
One more question. Why is necessary the serialization process? It is assumed that zeromq works via TCP and in the TCP protocol, the data does not undergo any transformation? This is related with the fact of that I have different platform/languages? On Thu, Jan 25, 2018 at 4:45 PM Bernardo Augusto

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-25 Thread Bernardo Augusto García Loaiza
Hi Thomas, Thanks for your illustrative response I'll look Google Protocol Buffers. My sender is from C++ language and my reception is Python. What sort of installation recommend me you? Binaries or build protocol buffer along my C++ runtime? or o build protoc binary from source? On Wed, Jan 24,

Re: [zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-24 Thread Thomas Rodgers
You can have a look at Python’s ctypes module, which will let you define a ‘struct’ from Python with the same layout as your C++ struct. You can also investigate any number of serialization libraries that have C++ and Python support, eg ProtoBufs or Thrift, or MagPack or whatever. On Wed, Jan

[zeromq-dev] Communication between C++ zmq client and Python zmq Server

2018-01-24 Thread Bernardo Augusto García Loaiza
Hi, ZMQ people. Greetings. I have a C++ zeromq client process in which I am sending some data members structures *ZMQComponent.h* file #include #include // To Quat datatype #include using sofa::defaulttype::Quat; using std::string; namespace sofa { namespace component { namespace