[zeromq-dev] biicode & zeromq

Riskybiz riskybizlive at live.com
Sat Sep 27 18:56:46 CEST 2014


Diego,

                Thanks for your suggestion via the zeromq mailing list to
try biicode to build the zguide examples on Windows.   The paragraph in your
blog post/tutorial <http://blog.biicode.com/zeromq-cpp-biicode/>  was
exactly my experience;

 

"Today, if you try to build the basic C++ client-server example that ZeroMQ
provides in their site, you might encounter some problems. You have to guess
that the C++ binding is not in the library, instead, it's inside another
repo (zmqcpp). I had to google it myself to find it. You have to get,
configure and build the library, then setup your own project to use it."

 

I code in C++ and have a necessity to use zeromq on Windows.  Because of the
limited zguide explanations on how to install, setup and integrate zeromq
into a C++ (and Windows) code project environment it is possible to go
around in circles for quite some time.

 

I began my zeromq experience by using the cppzmq language binding until I
had a question on how to retrieve a returned error message from a cppzmq
function call; it was suggested to me (on the zeromq mailing list) that in
order to do this I should use the raw zeromq api calls rather than the
binding.  I now use a hybrid of C++ and raw zeromq function calls, because
this to me is the simplest way to understand what is actually happening;
though after reading the zmqcpp source last night (after a suggestion from
another person who commented on my recent zeromq feedback) I now see that it
should really be possible to get the error message via the cppzmq binding,
it is provided for. 

 

Having the option of using either the language binding or the raw zeromq
calls  in a C++ environment tends to breed confusion in a beginner; there
are two sets of commands to memorise (and confuse), add on top of that the
multipart message API introduced in some examples and the zhelpers file
combining to offer so many commands and ways to send a message, it is very
easy to get lost amongst the details.  In fact just working out that there
was the option of using a binding or the raw api calls took some
considerable time.

 

Anyhow back to the matter in hand, I installed biicode and followed the blog
post/tutorial <http://blog.biicode.com/zeromq-cpp-biicode/> .   You'll be
please to hear that I successfully built hwserver & hwclient and ran them in
an ordinary Windows console.   I now have some feedback, questions and a
challenge for you....if you don't mind?  You may tell from the questions
that I'm not sure yet that I fully understand the magic inside biicode!

 

1.       "Building this example is straightforward with biicode. If you
haven't installed it yet, you  might want  WILL NEED to try
<http://docs.biicode.com/c++/gettingstarted.html> the C++ getting started
first."  I downloaded and installed biicode but initially missed the need
for the 'bii setup:cpp' command which meant I got errors pertaining to not
being able to find "Visual Studio 12", which was already installed.

 

2.       Is Biicode, for want of a better term; cross compiling? Taking code
intended for one platform and compiling it for another? That would be
incredible? Or is it more the case of specifying the language differences
between compilers using #include statements such as the difference between
sleep() and Sleep().  N.B. I think that Sleep(n * 1000) would be more
appropriate to convert milliseconds to seconds.

 

#include "diego/zmqcpp/zmq.hpp"

#include <string>

#include <iostream>

#ifndef _WIN32

#include <unistd.h>

#else

#include <windows.h>

 

#define sleep(n)    Sleep(n)

#endif

 

3.       Where is biicode downloading dependency files from?  Have I got
this right, is it downloading dependencies?  If it is downloading why can
biicode automatically find some of the necessary files yet others are to be
uploaded by the user?  For example where is this location #include
"diego/zmqcpp/zmq.hpp"

 

4.       How does biicode know which version of zeromq to use for a given
zguide example?

 

5.       Is the biicode using an intermediate language interpreter in the
fashion of Java or C#.  Is the application code it produces native?

 

6.       Tell me if I understand biicode correctly.  Say, for example, I
wrote my own message handling server in C++ using the current stable version
of zeromq. When finished I add the C++ source to biicode (Could this be on
my local machine and/or on the biicode cloud?) which then analyses and
retrieves its dependencies, right?  When later, and after a newer version of
zeromq is released, I want to integrate my server in a different code
project then I can do so from Visual Studio (Express versions also??) with a
simple;  #include "server" directive and without having to specify
include-files or linker-instructions or other similar Visual Studio project
configurations on which the server code depends?  The new project will
compile as would normally be expected into a single functioning application
file, no extra DLLs or such?

 

7.       Does biicode integrate with Visual Studio or does it stand alone?

 

8.       There was a breaking change to ROUTER socket identities between
zeromq versions.  From the zguide: "As a historical note, ZeroMQ v2.2 and
earlier use UUIDs as identities, and ZeroMQ v3.0 and later use short
integers."  I believe the Paranoid-Pirate-Pattern
<http://zguide.zeromq.org/page:all#Robust-Reliable-Queuing-Paranoid-Pirate-P
attern>  example from the zguide was affected by the change because it uses
this function to set the identity:

 

>From zhelpers.hpp

//  Set simple random printable identity on socket

//

inline std::string

s_set_id (zmq::socket_t & socket)

{

    std::stringstream ss;

    ss << std::hex << std::uppercase

       << std::setw(4) << std::setfill('0') << within (0x10000) << "-"

       << std::setw(4) << std::setfill('0') << within (0x10000);

    socket.setsockopt(ZMQ_IDENTITY, ss.str().c_str(), ss.str().length());

    return ss.str();

}

 

As a challenge are you able to demonstrate (tutorial style) how to use
biicode to make this example functional with its correct dependencies on an
older version of zeromq?

 

9.       I'm intruiged by your revenue sharing plan.  Are you able to
explain who pays whom and for what product or service?

 

10.   Can someone, not a figurehead (joke! You'd have to know the story!)
but someone esteemed, in the zeromq community please tell me if this is the
right place for this conversation or whether it should be continued
elsewhere?

 

Many thanks,

 

Riskybiz.

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140927/1b7020b3/attachment.htm>


More information about the zeromq-dev mailing list