Re: [zeromq-dev] zeromq-dev Digest, Vol 93, Issue 6
KIU Shueng Chuan, Very may thanks; truly you're a genius. Riskybiz. Message: 7 Date: Sun, 6 Sep 2015 08:16:12 +0800 From: KIU Shueng Chuan Subject: Re: [zeromq-dev] 64bit error setting socket linger value. To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="utf-8" "sizeof (&linger)" should be "sizeof (linger)" -- next part -- An HTML attachment was scrubbed... URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150906/2810a49e/a ttachment-0001.htm -- ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev End of zeromq-dev Digest, Vol 93, Issue 6 * ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] 64bit error setting socket linger value.
On Windows 7 & using Visual Studio 2013 with a 64bit build of zeromq 4.1.0.5 to link against I'm compiling a 64bit application (c++). All seems to work well, sockets are communicating, except the application is giving the error: Socket_1pt1: Socket: Error Setting Linger Value: consumer_subscriber Invalid argument Generated by the code: //LINGER int linger(0); size_t linger_size = sizeof(&linger); rv = zmq_setsockopt(sock, ZMQ_LINGER, &linger, linger_size);//N.B. rv is an int. if (rv != 0) { std::string errStr = zmq_strerror(zmq_errno()); std::string errConc = "Socket: Error Setting Linger Value: " + name + " " + errStr; TextOutput(errConc);; } else { std::string errConc = "Socket: LINGER VALUE SET: " + name + " "; TextOutput(errConc);; } Anyone know what's wrong here? Incidentally, the same code does not give an error under a 32 bit build configuration. Thanks, Riskybiz ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] zmq_poll question.
If I an application uses zmq_poll() before sending or receiving messages to check socket(s) for these events; ZMQ_POLLIN For ØMQ sockets, at least one message may be received from the socket without blocking. For standard sockets this is equivalent to the POLLIN flag of the poll()system call and generally means that at least one byte of data may be read fromfd without blocking. ZMQ_POLLOUT For ØMQ sockets, at least one message may be sent to the socket without blocking. For standard sockets this is equivalent to the POLLOUT flag of the poll()system call and generally means that at least one byte of data may be written tofd without blocking. Does it imply that a check has been made which will ensure that the HWM (high water mark) of a sending or receiving socket will not be exceeded? So that for example; Consider a DEALER-ROUTER connection where the ZMQ_ROUTER has reached a mute state and is dropping messages. Is it the case that by checking for ZMQ_POLLOUT on the ZMQ_DEALER before sending to the ZMQ_ROUTER that it would prevent a message from being sent and consequently dropped by the ZMQ_ROUTER. Additionally the ZMQ_ROUTER could be set up using zmq_poll() to check for ZMQ_POLLIN & ZMQ_POLLOUT which would prevent exceeding its HWM by not accepting further inbound messages when in the mute state; so that whilst the socket may be full to the HWM it will not drop any messages? When considering the zeromq api entry for zmq_poll() <http://api.zeromq.org/4-1:zmq-poll> I see that; ZMQ_POLLIN For ØMQ sockets, at least one message may be received from the socket without blocking. ZMQ_POLLOUT For ØMQ sockets, at least one message may be sent to the socket without blocking. May I ask, how does this relate to multi-part messages? Is it that a single zmq_msg_t message frame could be sent or received? Would an single entire multi-part message be OK? I intend to be using the clone pattern and it could be the case that a single very large multi-part message carrying the state could be the next to be sent. I would like to minimise the possibility that my code could cause messages to get dropped by considering the implications of acting to send & receive only on satisfactory poll events? Any elaboration on these subjects is much appreciated. With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] ROUTER-DEALER zmq_proxy Question.
Reading the zeromq api <http://api.zeromq.org/4-0:zmq-proxy> docs I see that a zmq_proxy can be used as a shared queue. 'Shared queue When the frontend is a ZMQ_ROUTER socket, and the backend is a ZMQ_DEALER socket, the proxy shall act as a shared queue that collects requests from a set of clients, and distributes these fairly among a set of services. Requests shall be fair-queued from frontend connections and distributed evenly across backend connections. Replies shall automatically return to the client that made the original request.' I have a few (simple) questions on zmq_proxy which I hoped someone might be able to answer; 1.What is the maximum size of a zmq_proxy queue, what is its capacity for storing queued messages; is it related to the high-water-mark settings of the constituent sockets? Or is it able to grow to any size limited only by available memory. Or something else entirely? 2.How fast does a zmq_proxy run and process messages; does it run as fast as possible in its thread? Does it poll at intervals and then sleep for a period? Does it somehow respond to load and throttle up and down as necessary? 3.Just to clarify before I start coding J: Is a ROUTER-DEALER zmq_proxy a bidirectional queue? What I'm considering is this; A ROUTER-DEALER zmq_proxy with a set of clients communicating with the zmq_proxy ROUTER socket and an answering service using the zmq_proxy DEALER socket. Could the answering service pull an inbound queued message off the zmq_proxy DEALER socket; process it, catch the identity of the originator client, create a response, prepend the identity and then send the response back through the same zmq_proxy DEALER socket and have it routed back to the correct originating client? i.e. Both inbound and outbound queues would conceptually be built into a single ROUTER-DEALER zmq_proxy? With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] CZMQ selftest build fails.
Finally I'm able to get CZMQ to build on Windows 7 using the Visual Studio 2013 solution. However there are a couple of issues; Without this section commented out of czmq_prelude.h then the build gave many errors relating to int8_t redefinition. N.B. This computer has Mingw installed if that makes any difference. # if ((!defined (__MINGW32__) \ || (defined (__MINGW32__) && defined (__IS_64BIT__))) \ && !defined (ZMQ_DEFINED_STDINT)) typedef __int8 int8_t; typedef __int16 int16_t; typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; # endif The other issue is that the czmq_selftest build fails like so: -- Build started: Project: czmq_selftest, Configuration: ReleaseDEXE Win32 -- 1> ConfigurationType : Application 1> Configuration : ReleaseDEXE 1> PlatformToolset : v120 1> TargetPath: C:\zeromq4-1\czmq\builds\msvc\vs2013\czmq_selftest\..\..\..\..\bin\Win32\Rel ease\v120\dynamic\czmq_selftest.exe 1> Linkage-czmq : dynamic 1> Linkage-libzmq: dynamic 1> Linkage-libsodium : dynamic 1>czmq_selftest.obj : error LNK2001: unresolved external symbol __imp__zsys_allocs 1>C:\zeromq4-1\czmq\builds\msvc\vs2013\czmq_selftest\..\..\..\..\bin\Win32\R elease\v120\dynamic\czmq_selftest.exe : fatal error LNK1120: 1 unresolved externals == Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped == Does anyone please know how to fix this? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] zeromq4-1 build errors using Visual Studio solution.
I've cloned https://github.com/zeromq/zeromq4-1 and copied it to the location C:\zeromq4-1 on my machine. I've then opened the Visual Studio 2013 solution and tried to build zeromq using either the 'StaticRelease' or 'DynamicRelease' settings. Either way I get errors, such as listed below. Does anyone please know how to fix this? Thanks, Riskybiz. 1>-- Build started: Project: libzmq, Configuration: ReleaseLIB Win32 -- 1> ConfigurationType : StaticLibrary 1> Configuration : ReleaseLIB 1> PlatformToolset : v120 1> TargetPath: C:\zeromq4-1\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Release\v120\st atic\libzmq.lib 1> Option-openpgm: 1> Option-sodium : true 1> Option-gssapi : 1> Linkage-libsodium : static 1> address.cpp 1> clock.cpp 1> ctx.cpp 1> curve_client.cpp 1> curve_server.cpp 1> dealer.cpp 1> devpoll.cpp 1> dist.cpp 1> epoll.cpp 1> err.cpp 1> fq.cpp 1> gssapi_client.cpp 1> gssapi_mechanism_base.cpp 1> gssapi_server.cpp 1> io_object.cpp 1> io_thread.cpp 1> ip.cpp 1> ipc_address.cpp 1> ipc_connecter.cpp 1> ipc_listener.cpp 1> kqueue.cpp 1> lb.cpp 1> mailbox.cpp 1> mechanism.cpp 1> metadata.cpp 1> msg.cpp 1> mtrie.cpp 1> null_mechanism.cpp 1> object.cpp 1> options.cpp 1> own.cpp 1> pair.cpp 1> pgm_receiver.cpp 1> pgm_sender.cpp 1> pgm_socket.cpp 1> pipe.cpp 1> plain_client.cpp 1> plain_server.cpp 1> poll.cpp 1> poller_base.cpp 1> precompiled.cpp 1> proxy.cpp 1> pub.cpp 1> pull.cpp 1> push.cpp 1> random.cpp 1> raw_decoder.cpp 1> raw_encoder.cpp 1> reaper.cpp 1> rep.cpp 1> req.cpp 1> router.cpp 1> select.cpp 1> session_base.cpp 1> signaler.cpp 1> socket_base.cpp 1> socks.cpp 1> socks_connecter.cpp 1> stream.cpp 1> stream_engine.cpp 1> sub.cpp 1> tcp.cpp 1> tcp_address.cpp 1> tcp_connecter.cpp 1> tcp_listener.cpp 1> thread.cpp 1> trie.cpp 1> v1_decoder.cpp 1> v1_encoder.cpp 1> v2_decoder.cpp 1> v2_encoder.cpp 1> xpub.cpp 1> xsub.cpp 1> zmq.cpp 1> zmq_utils.cpp 1>..\..\..\..\src\zmq.cpp(631): warning C4244: 'return' : conversion from 'int64_t' to 'int', possible loss of data 1> libzmq.vcxproj -> C:\zeromq4-1\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Release\v120\st atic\libzmq.lib 2>-- Build started: Project: inproc_thr, Configuration: ReleaseSEXE Win32 -- 3>-- Build started: Project: inproc_lat, Configuration: ReleaseSEXE Win32 -- 4>-- Build started: Project: remote_thr, Configuration: ReleaseSEXE Win32 -- 5>-- Build started: Project: remote_lat, Configuration: ReleaseSEXE Win32 -- 2> ConfigurationType : Application 2> Configuration : ReleaseSEXE 2> PlatformToolset : v120 2> TargetPath: C:\zeromq4-1\builds\msvc\vs2013\inproc_thr\..\..\..\..\bin\Win32\Release\v12 0\static\inproc_thr.exe 2> Linkage-libzmq: static 2> Linkage-libsodium : static 2> inproc_thr.cpp 3> ConfigurationType : Application 3> Configuration : ReleaseSEXE 3> PlatformToolset : v120 3> TargetPath: C:\zeromq4-1\builds\msvc\vs2013\inproc_lat\..\..\..\..\bin\Win32\Release\v12 0\static\inproc_lat.exe 3> Linkage-libzmq: static 3> Linkage-libsodium : static 3> inproc_lat.cpp 4> ConfigurationType : Application 4> Configuration : ReleaseSEXE 4> PlatformToolset : v120 4> TargetPath: C:\zeromq4-1\builds\msvc\vs2013\remote_thr\..\..\..\..\bin\Win32\Release\v12 0\static\remote_thr.exe 4> Linkage-libzmq: static 4> Linkage-libsodium : static 4> remote_thr.cpp 5> ConfigurationType : Application 5> Configuration : ReleaseSEXE 5> PlatformToolset : v120 5> TargetPath: C:\zeromq4-1\builds\msvc\vs2013\remote_lat\..\..\..\..\bin\Win32\Release\v12 0\static\remote_lat.exe 5> Linkage-libzmq: static 5> Linkage-libsodium : static 5> remote_lat.cpp 2>LINK : fatal error LNK1181: cannot open input file 'libzmq.lib' 3>LINK : fatal error LNK1181: cannot open input file 'libzmq.lib' 6>-- Build started: Project: local_thr, Configuration: ReleaseSEXE Win32 -- 6> ConfigurationType : Application 6> Configuration : ReleaseSEXE 6> PlatformToolset : v120 6> TargetPath: C:\zeromq4-1\builds\msvc\vs2013\local_thr\..\..\..\..\bin\Win32\Release\v120 \static\local_thr.exe 6> Linkage-libzmq: static 6> Linkage-libsodium : static 6> local_thr.cpp 7>-- Build started: Project: local_lat, C
[zeromq-dev] Implementing zeromq security
Tried getting the zeromq source code from an alternative place; Cloned https://github.com/zeromq/zeromq4-1 copied it to C:\zeromq4-1 and tried building on Windows using the Visual Studio 2013 solution. In this version I'm now able to see the; Configuration Properties->ZMQ Options and see that Enable Sodium is set to Yes. Used the 'StaticRelease' setting clicked 'Build Solution' and got the errors: Error 1 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\inproc_thr\LINKinproc_thr Error 2 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\inproc_lat\LINKinproc_lat Error 3 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\remote_lat\LINK remote_lat Error 4 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\remote_thr\LINK remote_thr Error 5 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\local_lat\LINKlocal_lat Error 6 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\local_thr\LINKlocal_thr Tried the 'DynRelease' and got the same errors: Error 1 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\inproc_thr\LINKinproc_thr Error 2 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\inproc_lat\LINKinproc_lat Error 3 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\remote_thr\LINK remote_thr Error 4 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\remote_lat\LINK remote_lat Error 5 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\local_thr\LINKlocal_thr Error 6 error LNK1181: cannot open input file 'libzmq.lib' C:\zeromq4-1\builds\msvc\vs2013\local_lat\LINKlocal_lat Checking: C:\zeromq4-1\bin\Win32\Release\v120\static\libzmq.lib C:\zeromq4-1\bin\Win32\Release\v120\dynamic\libzmq.lib I can verify that libzmq.lib exists in both locations. I would normally expect there to be a C:\zeromq-x.x.x\lib folder in the zeromq structure; it's where I'd normally find libzmq.lib to link with my application projects. In this case C:\zeromq-x.x.x\lib is absent. Does something need to be changed in the Visual Studio solution/project settings? Anyone know what it is? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Implementing zeromq security
>>For clarity, are you relying on zeromq/libzmq, zeromq/zeromq4-1 or zeromq/zeromq4-x? I WAS using the Visual Studio 2013 solution included with the source code for zeromq-4.0.4. Typically would simply open the solution set it to 'release' mode and click 'build solution'. This would not find the libsodium build already installed on my computer. Trying to manually link to libsodium gave build errors. >>Using zeromq/libzmq or zeromq/zeromq4-1: >>In the first two, builds/msvc/vs2013/libzmq.sln provides a solution file referencing all projects. In the Solution Explorer, right click and select 'Properties' to reach a screen with 'Configuration >>Properties' accessable. >From here you can reach 'ZMQ Options'. By default, sodium is enabled >which >>will define HAVE_LIBSODIUM. >>Linking in libsodium is handled by 'Local Dependencies', a peer of 'ZMQ Options'. It contains 'libsodium' and 'Linkage' which are currently by default linked. Please note that nuget will be used >>to pull down the libsodium package for linking. >>Using zeromq/zeromq4-x: >>A quick look shows that somehow this repo does not contain the latest refactor of project files. I know evoskuil put in a significant effort to achieve the above and so would advise taking a look >>at the 4-1 variant if at all possible. >From here http://zeromq.org/intro:get-the-software I downloaded http://download.zeromq.org/zeromq-4.1.0-rc1.zip . Extracted the files and went to C:\zeromq-4.1.0\builds\msvc\vs2013\libzmq.sln I tried to open the project using Visual Studio Express 2013. In the Solution Explorer each of the seven projects shows "load failed" with output errors: C:\zeromq-4.1.0\builds\msvc\vs2013\local_lat\local_lat.vcxproj : error : Unable to read the project file "local_lat.vcxproj". C:\zeromq-4.1.0\builds\msvc\vs2013\local_lat\local_lat.vcxproj(62,5): The imported project "C:\zeromq-4.1.0\builds\msvc\properties\Debug.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. On inspection file: C:\zeromq-4.1.0\builds\msvc\vs2013\local_lat\local_lat.vcxproj <---is present. C:\zeromq-4.1.0\builds\msvc\properties\Debug.props <--- is absent. Now what's wrong?? Many thanks for help so far Phillip; and apologies for causing a nuisance with this! Truly, it shouldn't be this difficult! Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Implementing zeromq security
Thanks for the suggestions on how to build zeromq-4.0.4 with libsodium curve security on Windows using the Visual Studio 2013 solution file. Getting warmer but there are still some issues... I've made this modification; builds/msvc/platform.hpp added: #define HAVE_LIBSODIUM 1 And also set the added these configuration options in the Visual Studio 2013 zeromq solution for the libzmq project; Set to 'Release' mode. C/C++ -> General-> Additional Include Directories -> C:\libsodium\src\libsodium\include Linker -> General -> Additional Library Directories -> C:\libsodium\bin\Win32\Release\v120\static N.B. Also tried the \dynamic folder but without luck. Linker -> Input -> AdditionalDependencies -> libsodium.lib The zeromq build is now looking for the libsodium files but gives the build errors: Error 4 error LNK1120: 3 unresolved externals C:\zeromq-4.0.4\bin\Win32\libzmq.dll libzmq Error 2 error LNK2001: unresolved external symbol "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t@zmq@@QAE@ABUoptions_t@1@@Z) C:\zeromq-4.0.4\builds\msvc\libzmq\stream_engine.objlibzmq Error 1 error LNK2001: unresolved external symbol "public: __thiscall zmq::curve_server_t::curve_server_t(class zmq::session_base_t *,class std::basic_string,class std::allocator > const &,struct zmq::options_t const &)" (??0curve_server_t@zmq@@QAE@PAVsession_base_t@1@ABV?$basic_string@DU?$char_t raits@D@std@@V?$allocator@D@2@@std@@ABUoptions_t@1@@Z) C:\zeromq-4.0.4\builds\msvc\libzmq\stream_engine.objlibzmq Error 3 error LNK2001: unresolved external symbol __imp__crypto_box_keypair C:\zeromq-4.0.4\builds\msvc\libzmq\zmq_utils.obj libzmq I'm not really sure of which build options to set there is the choice of: Debug, Release, Static Debug, Static Release, WithOpenPGM in the zeromq build and then the dynamic, static or ltcg folders to link against in the libsodium structure. I've tried various options which seem sensible but am really just pressing the buttons without understanding the implications of the differences! Anyone have any further suggestions? Thanks, Riskybiz. P.S. I've also considered the suggested options at http://lists.zeromq.org/pipermail/zeromq-dev/2014-November/027804.html but am unable to find any project or solution configuration setting relating to; (1) Properties->Configuration Properties->ZMQ Options->sodium->Enable Sodium value to 'No' (2) Properties->Configuration Properties->Local Dependencies->libsodium->Linkage to 'Not Linked' ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Implementing zeromq security
Ok, so I'm getting underway to create a demonstration project using zeromq and curve security on Windows 7 (64 bit). Started out by trying to create a security certificate and the code below is giving the error shown. char public_txt[41]; char secret_txt[41]; int rc = zmq_curve_keypair(public_txt, secret_txt); if(rc != 0) { std::string errStr = zmq_strerror(zmq_errno()); std::string errConc = "Error Creating KeyPair: " + errStr; std::cout << errConc.c_str() << std::endl; } Error Creating KeyPair: Not supported I suspect this is due to the zeromq build not picking up the libsodium files. I have the software located like so: C:\libsodium C:\zeromq-4.0.4 To try and fix the error I rebuilt libsodium and then rebuilt zeromq-4.0.4 both using provided solution files for Visual Studio 2013 on Windows 7. They both build OK but still the curve security is not supported. Can anyone please suggest what I should do to get the curve security built-in with zeromq? Also how do I run the self-tests to verify the installation is sound? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Implementing zeromq security
I'm trying to implement zeromq security for the first time and WITHOUT using CZMQ. Reading through http://hintjens.com/blog:49 & ZAP protocol info http://rfc.zeromq.org/spec:27 & code at zeromq-4.0.4\tests\tests_security_curve.cpp . I have a question and hope someone might be able to enlighten me At http://hintjens.com/blog:49 ; 'Internally, the authenticator talks to libzmq across <http://rfc.zeromq.org/spec:27> a protocol called ZAP, aka RFC 27. Every single time a client tries to connect to a server, libzmq asks the ZAP handler (the authenticator), if there is one installed, to allow or deny the connection.' In zeromq-4.0.4\tests\tests_security_curve.cpp ; // Spawn ZAP handler // We create and bind ZAP socket in main thread to avoid case // where child thread does not start up fast enough. void *handler = zmq_socket (ctx, ZMQ_REP); assert (handler); rc = zmq_bind (handler, "inproc://zeromq.zap.01"); assert (rc == 0); void *zap_thread = zmq_threadstart (&zap_handler, handler); Question is; I see that the zap_handler is provided with the pointer to the REP socket bound to "inproc://zeromq.zap.01" however I don't understand how libzmq is made aware to direct authentication requests to the particular handler socket. I don't see any further references in the code to "inproc://zeromq.zap.01"? How does libzmq know where to send the authentication requests? One other thing; is there any api documentation for zmq_threadstart & zmq_threadclose? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Implementing zeromq security.
I'd like to implement zeromq security on my interpretation of the 'clone' pattern and have been checking out: http://hintjens.com/blog:48 & http://hintjens.com/blog:49 . The security examples use CMZQ. Because CZMQ is not available to me on Windows I have created my own poll reactor and multipart message code in C++ to mimic the clone pattern; I know this is reinventing the wheel but it was the only practical means available to get the functionality needed on the platforms I use. In the same vein I'll have to create the security implementation from scratch. My questions are: Does anyone know of any good resources / examples demonstrating which RAW zeromq api calls need to be made to implement zeromq security? Seems like I should try and aim for the IronHouse pattern. Is it simply a case of setting requisite socket options and providing correct security keys? Are the handshaking processes which establish connection authenticity handled behind the scenes? What elements of the security process does zeromq provide for and what needs to be coded by the user? Does zeromq need to be built differently with security options enabled? Any assistance to get started is much appreciated, Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] zmqpp
Arnaud, Thank you for the suggestion to use https://github.com/zeromq/zmqpp . I did previously consider using it but could not build it on Windows. It's important that I'm able to use zeromq on Windows and program in c++. However upon your suggestion I looked again and noticed the following: Allow building zmqpp with Microsoft Visual Studio Changed preprocessor if directives to use || and && operators instead of words "and"/"or" Replaced noexcept definition (if not supported) with NOEXCEPT - C++11 standard forbids defining keywords and MSVC checks that even if the keyword is not implemented (checks since version 12 (2013)) Moved socket flags to source file to prevent linker warnings about duplicate definitions Moved inet functions into zmqpp namespace to resolve overload conflicts with system functions - windows provides an overload different only by the return value and that is forbidden in C++ I'd like to try using it; would it be too much to ask for a few instructions on what to do in order to get started and build zmqpp on Windows with Visual Studio 2013? Thanks again, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] ROUTER & identity value.
I've created this zeromq-4.0.4 MultiPartMessage.h <http://pastebin.com/hhKDamzt> class in C++. It functions nicely. However I cannot fathom one aspect of its behaviour When the receive constructor is called to receive a message off a ROUTER socket then the inbound message identity should be stored in the class member variable 'id' (circa line 161). However whenever I use the getIdentity() method on either Windows 7 or Debian Wheezy to get the value then print the identity to the console window then there is nothing to see, just a blank. What baffles me is that when replying to the message I use the getIdentity() method of the received message to set the destination identity in the send constructor of a different class instance AND the message gets back through to the originator. So it's possible to pass messages from DEALER to ROUTER put the MultiPartMessage in a queue and later send it back to the originating DEALER; but I cannot visualise the identity value in the console! Does anyone know why this should be? Perplexed. Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Poll Reactor Issue.
I’m creating a zeromq poll reactor with Visual Studio Express 2013 on Windows 7 64bit and working in Visual C++ using zeromq-4.0.4. The intent is an easily configurable object oriented piece of code to allow any number of user specified zeromq sockets to be polled and corresponding user defined functors to be called on relevant ZMQ_POLLIN and ZMQ_POLLOUT events. Trouble is I am experiencing an inexplicable issue. I have found that when run in the Visual Studio ‘Local Windows Debugger’ with either ‘release’ or ‘debug’ selected then my poll reactor examples; reactorServer.exe and reactorClient.exe will FUNCTION AS INTENDED and happily pass messages back and forth over a DEALER and ROUTER connection. Sending and receiving in both directions. HOWEVER when I open an ordinary console window and run the server program it begins to poll, but IMMEDIATELY that a client is connected (the client would be trying to send messages to the ROUTER socket of the server and the server would presumably be detecting a ZMQ_POLLIN event) then the server program crashes. I reiterate that when run in the debugger the server and client play nicely. After starting the ‘release’ version of my reactorServer.exe in an ordinary console window I attach that process to the Visual Studio debugger. I then deliberately crash the server by starting a reactorClient.exe. I get the following error reported by the debugger: Unhandled exception at 0x54093B2C (libzmq.dll) in reactorServer.exe: 0xC005: Access violation reading location 0x0068. Following through shows the server program crashed at this function in file ctx.cpp. zmq::io_thread_t *zmq::ctx_t::choose_io_thread (uint64_t affinity_) { if (io_threads.empty ()) return NULL; // Find the I/O thread with minimum load. int min_load = -1; io_thread_t *selected_io_thread = NULL; for (io_threads_t::size_type i = 0; i != io_threads.size (); i++) { if (!affinity_ || (affinity_ & (uint64_t (1) << i))) { >>>>>>int load = io_threads [i]->get_load ();<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>Crashes here. This is the next statement to execute. if (selected_io_thread == NULL || load < min_load) { min_load = load; selected_io_thread = io_threads [i]; } } } return selected_io_thread; } The call stack shows: >libzmq.dll!zmq::ctx_t::choose_io_thread(unsigned __int64 affinity_) > Line 339C++ libzmq.dll!zmq::tcp_listener_t::in_event() Line 100C++ libzmq.dll!zmq::select_t::loop() Line 185C++ libzmq.dll!thread_routine(void * arg_) Line 35C++ msvcr120.dll!_callthreadstartex() Line 376C msvcr120.dll!_threadstartex(void * ptd) Line 354C kernel32.dll!@BaseThreadInitThunk@12‑()Unknown ntdll.dll!___RtlUserThreadStart@8‑()Unknown ntdll.dll!__RtlUserThreadStart@8‑()Unknown I simply would like to ask if this offers a clue to someone familiar with the zeromq source code as to the likely problem? It could be my application code! But equally have I encountered some issue not of my making? Thanks, Riskybiz. P.S. Also built against zeromq-3.2.3 and found the same behaviour. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] CZMQ Build on Windows.
Just a little feedback. Finally, at last, I've been able to build CZMQ on Windows. Had to configure both projects in the CZMQ solution with 'include' and 'linker' instructions pointing at relevant zeromq-4.0.4 folders on my machine. The Visual Studio 2013 solution files worked well except for this from the file: libzmq.import.props THIS LINE COULD NOT FIND libzmq.dll SourceFiles="C:\zeromq-4.0.4\bin\Win32\libzmq.dll" SO I USED THIS INSTEAD; WHICH WORKED DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" /> Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] biicode & zeromq
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 (0x1) << "-" << std::setw(4) << std::setfill('0') << within (0x1); 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. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] DEALER-ROUTER question
Dear Pieter, As a figurehead of the zeromq project I think you should know that the zguide and its examples, whilst a worthy effort, is actually a barrier to the progress of a learner. As a newcomer to networking my interactions and attempts to learn and use zeromq over the past year has been an unyielding source of issues to be overcome. Anyone else would probably have given up, but I recognise the benefits of the superb technology offered by zeromq. Part of the problem is perhaps that the zguide has been written by experts, where seemingly minor details are glossed over. For example in the hwserver and hwclient code it is not demonstrated how actually to read a message payload from the socket and extract the received message string. It cheats and prints; printf ("Received World %d\n", request_nbr); When someone tries this early example the first thing they will experiment with is: How can I customise the message payload and get my own message sent and received? They will be disappointed. They might read on try to figure it out and be baffled by the multiple language bindings, apis and helper files and left wondering; what actually needs to be written to make zeromq work? What is the core underlying zeromq commands which need to be called? What needs to be installed? How do I do that? Where do I find the downloads? I encountered a situation last year when I needed to use the common technique of serialization to pass custom C++ objects over zeromq sockets. While the zguide alludes to the possibility there was nothing to offer assistance in the practical implementation. It took some considerable time, weeks, to sort this out into a functioning prototype. Where a simple functional guide example could have saved time and questions; not just for me but also for any number of other users. I find that the zguide code examples are in themselves problematic. The example code is very sparsely commented. Every line which does something non-trivial or zeromq specific should be explained. I have found examples to be zeromq version specific, operating system specific and requiring modifications to work on Windows. All of these factors just consume time in endeavouring to make them work or debug them with limited understanding of what is actually supposed to be happening. This causes questions and frustrations. CZMQ was recommended as the api to use with 'reference' C language code examples, I lost more time trying to compile CZMQ before realising the practical impossibility of this on Windows despite alluringly providing Visual Studio project files. The lack of working installation instructions was also a barrier. Then afterwards I discover that ROUTER sockets in updated zeromq versions no longer use UUID identities thus anyway invalidating the code example I was endeavouring to get working. More lost time, more questions. No progress. My suggestion is that if you want fewer basic questions asked in the community then please take time to revisit the zguide, its examples and necessary zeromq code resources and make it such that people can easily find the resources they need, confidently learn and demonstrate the examples and functionality for themselves; without enduring endless technical barriers and frustrations. I hope you will view my feedback as constructive. All that said; which part of the guide should I read to solve my DEALER-ROUTER issue, can I be confident that any associated zguide example will actually work and help me to further understand how to solve my own zeromq issues in the future? Riskybiz. Message: 29 Date: Thu, 25 Sep 2014 11:29:01 +0200 From: Pieter Hintjens Subject: Re: [zeromq-dev] DEALER-ROUTER question. To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset=UTF-8 Please read the Guide and work through the examples, it has lots of explanation and examples of how to do this kind of thing. On Thu, Sep 25, 2014 at 10:36 AM, Riskybiz wrote: > A quick question for the zeromq experts if I may? > > > > Given a DEALER to ROUTER zeromq connection which is able to operate > asynchronously; what is the best way to coordinate inbound and outbound > message handling such that the DEALER socket is not blocked and an > application is able to react and send at a given moment but also to promptly > receive? > > > > Thanks, > > > > Riskybiz. > > > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > -- ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev End of zeromq-dev Digest, Vol 81, Issue 25 ** ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] DEALER-ROUTER question.
A quick question for the zeromq experts if I may? Given a DEALER to ROUTER zeromq connection which is able to operate asynchronously; what is the best way to coordinate inbound and outbound message handling such that the DEALER socket is not blocked and an application is able to react and send at a given moment but also to promptly receive? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Trouble sending from ROUTER to DEALER
Many thanks for the inspiring code example and comments KIU Shueng Chuan your suggestions were the answer. The example is now passing messages as intended. One final issue baffles me though; despite the identity being stored in a std::string and the reply message getting through from ROUTER to DEALER, when the identity is printed to the console the output remains garbled. I've updated the code at: zmqRouter http://pastebin.com/jD4LsUKU zmqDealerClient http://pastebin.com/1AqWXbTG multiPartMessage http://pastebin.com/hhKDamzt Riskybiz. Date: Fri, 19 Sep 2014 07:50:18 +0800 From: KIU Shueng Chuan Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="iso-8859-1" zmq_msg_init_size(&messageOut, sizeof id ); memcpy(zmq_msg_data(&messageOut), &id, sizeof id); In the above 2 lines in your multipartmsg.h, replace "sizeof id" with "id.size()" and "&id" with "id.data()". -- next part -- An HTML attachment was scrubbed... URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140919/943ac2fa/a ttachment-0001.htm -- ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Trouble sending from ROUTER to DEALER
Thanks for the comments. Ive modified the simple example (C++) programs: zmqRouter <http://pastebin.com/jD4LsUKU> zmqDealerClient <http://pastebin.com/1AqWXbTG> and included header file multiPartMessage.h <http://pastebin.com/hhKDamzt> to extract the ROUTER generated identity (a blob of data) from the z_msg_t object and store it as a std::string. Sadly this does not give a working solution. Output is: router: Preparing router: Ready to receive --- Message Received --- Originator Identity: Ç ) Identity Message Size: 5bytes or 40bits Frame Vector Index: 0 Frame Data: Frame1 Frame Vector Index: 1 Frame Data: Frame2 Frame Vector Index: 2 Frame Data: Frame3 Frame Vector Index: 3 Frame Data: Frame4 Frame Vector Index: 4 Frame Data: Frame5 router: Ready to receive Note the garbled Originator Identity. Does anyone know how to make this example work? Just need to get hold of the identity, store it and make use of it later? Alternatively Ive read <http://stackoverflow.com/questions/10023547/manipulating-blobs-in-c> that a std::vector can be used to receive a blob of data. Anyone know how to get the message payload out of the z_msg_t object into a std::vector and then copied back into a different z_msg_t object. Thanks, Riskybiz. P.S. Necessity dictates that I use Windows for this work, sadly the CMZQ Visual Studio 2013 & 2012 projects will not build on Windows 7, 64 bit. Tried up to GitHub Merge pull request #651 a few days ago. Really need C++ too. J -- Date: Wed, 17 Sep 2014 20:39:55 +0200 From: Pieter Hintjens Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset=UTF-8 It is fairly simple: - use CZMQ and switch from C++ to C (:-) - use zframe_recv or zmsg_recv and zmsg_pop -Pieter Date: Thu, 18 Sep 2014 09:42:39 +0800 From: KIU Shueng Chuan Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="iso-8859-1" You already use a std::string to store the non-identity parts of the multi-part message. Why not use the same data type for the identity part? The identity and non-identity parts are just data blobs. -- next part -- An HTML attachment was scrubbed... URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140918/16c66bdd/a ttachment-0001.htm -- ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Trouble sending from ROUTER to DEALER
Ok. I've been trying to get those 5 bytes of the ROUTER generated "identity" into a C++ variable so that it can be stored in memory and used to prepend an outbound message at some later time. Can anyone suggest how the identity data stored in a zmq_msg_t object and pointed to by: zmq_msg_data(&messageIn) could be stored in a variable which; 1. Is easily printable on the console. 2. Can be simply copied into a zmq_msg_t object to form the identity frame of a message sent via a ROUTER socket. 3. Works without knowing that auto generated identities are of any specific size. Stuck. Riskybiz. Date: Tue, 16 Sep 2014 22:45:52 +0800 From: KIU Shueng Chuan Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="iso-8859-1" In your multipartmsg.h file, you have code that does the following: int32_t id = *(static_cast(zmq_msg_data(&messageIn))) You have assumed that the auto generated identity is 4 bytes long, whereas it is in fact 5 bytes long. So when sending a reply, you would have sent a truncated identity, which the router socket know nothing about. More generally, you shouldn't need to write your code to "know" that auto generated identities are of any specific size. -- next part -- An HTML attachment was scrubbed... URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140916/3819b97f/a ttachment-0001.htm -- ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Trouble sending from ROUTER to DEALER
Apologies, I should have included the line I had used to determine the size of the identity: "size_t id_size = (sizeof zmq_msg_data(&messageIn));//size in bytes" I think this is the size of the data payload of the zmq_msg_t object, but perhaps it is the size of the pointer returned from zmq_msg_data(&messageIn)? Whereas your line is: "printf("identity frame size: %ld bytes\n", zmq_msg_size(&messageIn));" When run on my system I concur that your line gives output of "5 bytes". router: Preparing router: Ready to receive identity frame size: 5 bytes --- Message Received --- Originator Identity: 32768 Identity Message Data Payload: 4bytes or 32bits Frame Vector Index: 0 Frame Data: Frame1 Frame Vector Index: 1 Frame Data: Frame2 Frame Vector Index: 2 Frame Data: Frame3 Frame Vector Index: 3 Frame Data: Frame4 Frame Vector Index: 4 Frame Data: Frame5 MultiPartMessage: Sending to connection identity: 32768 Size of identity: 4bytes or: 32bits router: Ready to receive Though I'm not sure how to use this information to make the example function as intended. I also tried added a blank message frame after the identity frame as suggested by Rodrigo Mosconi, but that did not fix the problem. I was working under the impression that any sequence of zmq_msg_t objects could be sent via a ROUTER socket so long as the identity of the destination was the first frame? Also that the 'blank' frame was necessary for certain socket types only e.g. REQ-REP? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Trouble sending from ROUTER to DEALER
I made a quick modification to check the size of the received identity frame. It shows as 32 bits. Console output is: router: Preparing router: Ready to receive --- Message Received --- Originator Identity: 32768 Size of identity frame: 32bits Frame Vector Index: 0 Frame Data: Frame1 Frame Vector Index: 1 Frame Data: Frame2 Frame Vector Index: 2 Frame Data: Frame3 Frame Vector Index: 3 Frame Data: Frame4 MultiPartMessage: Sending to connection identity: 32768 Size of identity: 32bits router: Ready to receive Date: Mon, 15 Sep 2014 10:44:46 +0800 From: KIU Shueng Chuan Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="iso-8859-1" You may want to check whether the received identity frame is only 32-bits in length. On 15 Sep 2014 02:30, "Riskybiz" wrote: > Dear zeromq developers, > > > > I've created a couple of simple Windows C++ console programs > zmqDealerClient <http://pastebin.com/1AqWXbTG> & zmqRouter > <http://pastebin.com/jD4LsUKU> to understand zeromq (4.0.4) > ROUTER-DEALER connections. Both use the header file multiPartMessage > <http://pastebin.com/hhKDamzt> to handle the preparation, sending and > receiving of multipart messages. I can get a message to pass from the > DEALER to the ROUTER with the resultant console output of: > > > > router: Preparing > > router: Ready to receive > > --- Message Received > --- > > Originator Identity: 32768 > > Frame Vector Index: 0 Frame Data: Frame1 > > Frame Vector Index: 1 Frame Data: Frame2 > > Frame Vector Index: 2 Frame Data: Frame3 > > Frame Vector Index: 3 Frame Data: Frame4 > > -- > -- > > MultiPartMessage: Sending to connection identity: 32768 > > router: Ready to receive > > > > However when zmqRouter attempts to send a reply from ROUTER back to > the originating DEALER then the message is not getting through > properly and the zmqDealerClient output stalls at; > > > > dealerClient: Preparing > > dealerClient: Dealer Socket Ready > > dealerClient: MultiPartMessage Sent > > dealerClient: Awaiting Reply > > > > Along with the following error messages from zmqRouter; > > > > [9668] MultiPartMessage: Error Sending Identity Message Part: Unknown > error > > [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown > error > > [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown > error > > [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown > error > > > > The multi part message being sent via the ROUTER to the DEALER is > prepended with the identity of the DEALER socket, I'm unsure of the > problem here; can anyone explain what I've done wrong? > > > > Also I notice that if I run two instances of zmqDealerClient in > separate console windows, both connecting to the same instance of > zmqRouter, then both clients appear to have the same identity. The > code I've written uses the default situation where the ROUTER socket > sets the identities internally. I expected each instance to have a > unique identity. Anyone know why this is not the case? > > > > With thanks, > > > > Riskybiz. > ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Trouble sending from ROUTER to DEALER
Dear zeromq developers, I've created a couple of simple Windows C++ console programs zmqDealerClient <http://pastebin.com/1AqWXbTG> & zmqRouter <http://pastebin.com/jD4LsUKU> to understand zeromq (4.0.4) ROUTER-DEALER connections. Both use the header file multiPartMessage <http://pastebin.com/hhKDamzt> to handle the preparation, sending and receiving of multipart messages. I can get a message to pass from the DEALER to the ROUTER with the resultant console output of: router: Preparing router: Ready to receive --- Message Received --- Originator Identity: 32768 Frame Vector Index: 0 Frame Data: Frame1 Frame Vector Index: 1 Frame Data: Frame2 Frame Vector Index: 2 Frame Data: Frame3 Frame Vector Index: 3 Frame Data: Frame4 MultiPartMessage: Sending to connection identity: 32768 router: Ready to receive However when zmqRouter attempts to send a reply from ROUTER back to the originating DEALER then the message is not getting through properly and the zmqDealerClient output stalls at; dealerClient: Preparing dealerClient: Dealer Socket Ready dealerClient: MultiPartMessage Sent dealerClient: Awaiting Reply Along with the following error messages from zmqRouter; [9668] MultiPartMessage: Error Sending Identity Message Part: Unknown error [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown error [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown error [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown error The multi part message being sent via the ROUTER to the DEALER is prepended with the identity of the DEALER socket, I'm unsure of the problem here; can anyone explain what I've done wrong? Also I notice that if I run two instances of zmqDealerClient in separate console windows, both connecting to the same instance of zmqRouter, then both clients appear to have the same identity. The code I've written uses the default situation where the ROUTER socket sets the identities internally. I expected each instance to have a unique identity. Anyone know why this is not the case? With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Router socket and connection identities?
Dear zeromq developers, I intend to create an example DEALER-ROUTER network arrangement which will pass multipart messages containing a variable number of parts. As I understand it a ROUTER socket uses an identity for each of the connections with which it corresponds; the identities are stored internally by the ROUTER socket in a lookup container. My question is: Is it necessary in my code to create a unique identity for each connection and then pass it to the ROUTER socket OR does the ROUTER socket create the necessary identity internally? Also, does anyone please know of a simple console example of a ROUTER-DEALER arrangement which I may study and which will work on Windows using zeromq-4.0.4? With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Paranoid Pirate
Is it these lines which are the problem with c_str() in the Paranoid Pirate Queue? msg.push_front((char*)identity.c_str()); msg.wrap (it->identity.c_str(), NULL); What can be done to fix the problem, not using uuid identifiers? Replacing uuids in the Paranoid Pirate Queue code with calls to s_set_id ()? But it begs the question; how should the uuid identifiers be properly handled and passed around in code? Surely Paranoid Pirate pattern must have worked with uuids at some point in time otherwise how would it have passed muster for the zeromq guide? Confused. Riskybiz. Message: 8 Date: Tue, 26 Aug 2014 06:15:54 +0800 From: KIU Shueng Chuan Subject: Re: [zeromq-dev] Paranoid Pirate To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="iso-8859-1" The zmsg class api takes in char* and the pirate queue has code that passes it identities as c_str(). This doesn't work since identities are not nul terminated c strings and may contain nuls. It works for the workers only because they explicitly set their own id to something containing only characters. See s_set_id (). On 26 Aug 2014 04:33, "Riskybiz" wrote: > Dear zeromq developers, > > > > I'm trying to get the Paranoid Pirate pattern to > operate on Debian Linux using zeromq-4.0.4. (When I get it working on > Linux then I will turn my attention to making it work on Windows). > The Paranoid Pirate Queue <http://pastebin.com/KTsn4Yq8> and the > Paranoid Pirate Worker <http://pastebin.com/hLHRC2LB> are > communicating and demonstrably heartbeating. The problem is that the > Lazy Pirate Client <http://pastebin.com/Ekd1ZGQF> does not appear to > communicate properly or receive a reply message. Is anyone able to identify what is wrong here? > There are a couple of other necessary files; zhelpers.h > <http://pastebin.com/ir8bkQaU> and zmsg.hpp > <http://pastebin.com/4KYir507> . > > I have changed int64_t more = 0; to int more = 0; as kindly pointed > out by KIU Shueng Chuan as being necessary for zeromq-3.2.x and > higher. Also added are some console print statements to trace what is > actually going on. In order to correct very long waiting times I have > modified the delay periods built in to the pattern from those provided > by the stock example in the zeromq guide. > > Hope someone is able to help. > > Thanks, > > Riskybiz. > > > > ___ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > -- next part -- An HTML attachment was scrubbed... URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140826/03acd436/a ttachment-0001.htm -- ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev End of zeromq-dev Digest, Vol 80, Issue 24 ** ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Paranoid Pirate
Dear zeromq developers, I'm trying to get the Paranoid Pirate pattern to operate on Debian Linux using zeromq-4.0.4. (When I get it working on Linux then I will turn my attention to making it work on Windows). The Paranoid Pirate Queue <http://pastebin.com/KTsn4Yq8> and the Paranoid Pirate Worker <http://pastebin.com/hLHRC2LB> are communicating and demonstrably heartbeating. The problem is that the Lazy Pirate Client <http://pastebin.com/Ekd1ZGQF> does not appear to communicate properly or receive a reply message. Is anyone able to identify what is wrong here? There are a couple of other necessary files; zhelpers.h <http://pastebin.com/ir8bkQaU> and zmsg.hpp <http://pastebin.com/4KYir507> . I have changed int64_t more = 0; to int more = 0; as kindly pointed out by KIU Shueng Chuan as being necessary for zeromq-3.2.x and higher. Also added are some console print statements to trace what is actually going on. In order to correct very long waiting times I have modified the delay periods built in to the pattern from those provided by the stock example in the zeromq guide. Hope someone is able to help. Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Zeromq Paranoid Pirate & Majordomo examples.
Dear 0MQ developers, For some months I've been trying to get the Paranoid Pirate & Majordomo patterns working so that I may study their operation and implement the principles in some new development work I have in mind. What I would like to achieve is relatively simple. . Using 0MQ networking I would like several sources (REQ?) of time-series data to pass any accumulated time series data history to a central point (ROUTER?). . When the accumulated data history has been passed then the sources would pass real time updates to the central point; as and when the new data are generated. . I would like the data flows to be asynchronous and that the data sources 'push' data to the central point. . It is important that no data is lost due to slow joiner syndrome. It is also important that the data arrives in the correct order; otherwise the data will be gobbledegook. . A facility to detect when data sources have died/gone away, heartbeating. . Preferably to I'd like to work in C++; it's familiar. . Windows 7 compatibility is essential, I am tied to using Windows it is where the data sources will run. In working through the problems getting Paranoid Pirate & Majordomo to work I came to suspect that the problem lay in the REQ-ROUTER connection which is present in both the Paranoid Pirate and Majordomo patterns. This stackoverflow question explains some of approaches I've tried: Stackoverflow question <http://stackoverflow.com/questions/24597251/zeromq-issues-with-example-netw orking-patterns-paranoid-pirate-and-majordomo> I even tried building CZMQ on Windows 7 so that I could try the C language original versions of the Paranoid Pirate & Majordomo patterns. Have you tried building CZMQ on Windows; it's just a nightmare? The provided Visual Studio solution file just didn't work and the instructions are practically non-existent. Searching the internet for help found rocket scientists <http://lists.zeromq.org/pipermail/zeromq-dev/2013-October/022981.html> proposing cross compilation as the solution; but where to start with that? Really should it be that difficult? All I could see there was another month of lost weekends. So all in all that was a dead end. Seeking answers & further investigating REQ-ROUTER I discovered this example: simple req2Router example <http://thisthread.blogspot.co.uk/2012/05/very-simple-req-router-example.htm l> and built it into a working Windows program. The cpp & header file code for it are here req2Router cpp file <http://pastebin.com/g66mzGm9> and zmq2.h header file <http://pastebin.com/yti8jUEc> . What I discovered was that this simple req2Router program would function properly when linked against zeromq-2.2.0 but would not function when linked against zeromq-3.2.3 or zeromq-4.0.4. N.B. When running tests I ensured that the corresponding libzmq.dll file was used from the relevant version of zeromq. Could this be the problem in getting the Paranoid Pirate & Majordomo examples to work; that the example code is zeromq version dependant? Does anyone know why this might be the case? What has changed between versions which would affect the REQ-ROUTER functionality? I really am stuck and getting tangled with this and am losing time to it. I cannot move forward with the plan I have in mind until I can get working implementations of Paranoid Pirate, Majordomo & Asynchronous Majordomo on Windows as a foundation on which to build. It's doubly difficult because I want to learn from the examples but debugging them at the same time is testing to say the least. Is anyone able to help get these examples working with the latest versions of zeromq on Windows, not just for my sake but also for the next person who tries? Surely I can't be the only person who needs or wants to try this? With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] CZMQ Build error.
Message: 3 Date: Tue, 22 Jul 2014 23:08:29 + From: Mellitus Ezeme Subject: [zeromq-dev] CZMQ Build error To: "zeromq-dev@lists.zeromq.org" Message-ID: <1406070493471.52...@mail.utoronto.ca> Content-Type: text/plain; charset="iso-8859-1" I am trying to build CZMQ on Visual Studio 2013 and I get the following errors. Error 1 error C1083: Cannot open include file: 'sodium.h': No such file or directory C:\Users\Tarbo\Desktop\czmq-2.2.0\src\zcert.c 39 1 czmq Error 2 error LNK1104: cannot open file 'C:\Users\Tarbo\Desktop\czmq-2.2.0\builds\msvc\vs2013\czmq_selftest\..\..\.. \..\..\libsodium\bin\Win32\Debug\libsodium12\libsodium.imp.lib' C:\Users\Tarbo\Desktop\czmq-2.2.0\builds\msvc\vs2013\czmq_selftest\LINK czmq_selftest I opened the include folder and truly, I can't find any "sodium.h" file. Could someone tell me how to locate the header file or how to build without libsodium or sodium as I tried commenting it out but the self test will then fail. Thanks. Mel. When building CZMQ I found it necessary to build sodium separately see http://labs.opendns.com/2013/03/06/announcing-sodium-a-new-cryptographic-lib rary/ and http://download.dnscrypt.org/libsodium/releases/ and https://github.com/jedisct1/libsodium Also the installation instructions at https://github.com/zeromq/libcurve were useful to me on a Linux system; but also elucidated what might necessarily need to be installed on Windows. I don't know if your experience will be different, but when building on CZMQ on Windows 7 it was necessary for me to solve several build errors by adding additional include directories and linking instructions to the CZMQ Visual Studio project. Riskybiz. -- next part -- An HTML attachment was scrubbed... URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140722/b0220587/a ttachment.html -- ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] CZMQ self test fail.
On Debian the czmq self test failed in the same manner on the couple of occasions I tried. I also found it necessary today to comment out the zgossip_test when building czmq on Windows 7 using Visual Studio Express 2013 because it was giving build errors. Finally I managed to build czmq on Windows 7. I used zeromq-4.0.4 and the latest czmq files from Github. I found that libzmq.lib has been renamed in zeromq-4.0.4 to libzmq_d.lib (underscore_d) and that the same change applies to various other files e.g. libzmq_d.dll. By editing the C:\czmq\builds\msvc\vs2013\libzmq.import.props file of the Visual Studio 2013 solution to reflect the file name changes and adding some project properties I was able to get czmq to build and demonstrate the Paranoid Pirate pattern example in C; 1. In file C:\czmq\src\czmq_selftest.c comment out the call to zgossip_test. 2. C/C++-> General->Additional Include Directories C:\zeromq-4.0.4\zeromq-4.0.4\include 3. Linker->General->Additional Library Directories C:\zeromq-4.0.4\zeromq-4.0.4\lib\Win32 4. Linker->Input->Additional Dependencieslibzmq_d.lib (N.B. UNDERSCORE d.) 5. In section of libzmq.import.props under 'Release' change line to SourceFiles="C:\zeromq-4.0.4\zeromq-4.0.4\bin\Win32\libzmq_d.dll" or wherever it is stored. May I kindly suggest that the person responsible for the czmq Visual Studio project files takes a look at improving the instructions and testing the project files in order to prevent others from enduring the lengthy and testing frustrations that I have been through in building czmq on Windows. Furthermore the Unix-like instructions at http://czmq.zeromq.org/page:get-the-software did not work on Debian; though those from https://github.com/zeromq/libcurve did. Riskybiz. -Original Message- From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev-boun...@lists.zeromq.org] On Behalf Of zeromq-dev-requ...@lists.zeromq.org Sent: 20 July 2014 11:00 To: zeromq-dev@lists.zeromq.org Subject: zeromq-dev Digest, Vol 79, Issue 18 Send zeromq-dev mailing list submissions to zeromq-dev@lists.zeromq.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.zeromq.org/mailman/listinfo/zeromq-dev or, via email, send a message with subject or body 'help' to zeromq-dev-requ...@lists.zeromq.org You can reach the person managing the list at zeromq-dev-ow...@lists.zeromq.org When replying, please edit your Subject line so it is more specific than "Re: Contents of zeromq-dev digest..." Today's Topics: 1. CZMQ self test fail. (Stephen Gray) 2. Re: CZMQ self test fail. (Pieter Hintjens) -- Message: 1 Date: Sat, 19 Jul 2014 18:25:41 +0100 From: Stephen Gray Subject: [zeromq-dev] CZMQ self test fail. To: "zeromq-dev@lists.zeromq.org" Message-ID: Content-Type: text/plain; charset="iso-8859-1" Whilst building czmq on Debian (Wheezy) I ran the 'make check' command and received the following output, so I'm reporting the error as requested: Running CZMQ selftests... * zrex: OK * zsys: OK * zchunk: OK * zconfig: OK * zmutex: OK * zclock: OK * zdir_patch: OK * zdir: OK * zdigest: OK * zframe: OK * zstr: OK * zmsg: OK * zfile: OK * zhash: OK * zlist: OK * zuuid: OK * zctx: OK * zsocket: OK * zsockopt: OK * zsock: OK * zsock_option: OK * zsock_monitor: OK * zactor: OK * zpoller: OK * zthread: OK * zloop: OK * zproxy: OK * zbeacon: OKlt-czmq_selftest: zgossip.c:411: zgossip_test: Assertion `zgossip_msg_id (reply) == 4' failed. * zgossip: /bin/bash: line 5: 19083 Aborted ${dir}$tstFAIL: czmq_selftest1 of 1 test failedPlease report to zeromq-dev@lists.zeromq.org -- next part -- An HTML attachment was scrubbed... URL: http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140719/91032d5e/a ttachment.html -- Message: 2 Date: Sun, 20 Jul 2014 00:29:53 +0200 From: Pieter Hintjens Subject: Re: [zeromq-dev] CZMQ self test fail. To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset=UTF-8 Does this happen systematically or sporadically? You can temporarily delete the call to zgossip_test from czmq_selftest.c, it's a new class and is presumably still unstable in some cases. On Sat, Jul 19, 2014 at 7:25 PM, Stephen Gray wrote: > Whilst building czmq on Debian (Wheezy) I ran the 'make check' command > and received the following output, so I'm reporting the error as requested: > > > Running CZMQ selftests... > * zrex: OK > * zsys: OK > * zchunk: OK > * zconfig: OK > * zmutex: OK > * zclock: OK > * zdir
[zeromq-dev] How to build czmq.h?
Thanks Pieter for the tip. In order to build the examples in c in order to do further testing I'm trying to build czmq on Windows using Visual Studio 2013 Express. I have these instructions: http://czmq.zeromq.org/page:get-the-software To build on Windows 1. You need Microsoft <http://www.microsoft.com/express/Downloads/#2010-Visual-CPP> Visual C++ 2008 or newer. 2. Unpack the .zip source archive. 3. In Visual C++ open the solution builds/msvc/vs/czmq.sln. 4. Build the solution. 5. CZMQ will be in the lib subdirectory. I find that the build process is giving errors related to missing files etc. For example the first error complains that zmq.h file cannot be found. I think; OK I know where that is so I paste it into the directory for include path for the project. Then it complains that libsodium something or other is missing. It's clear that something isn't right here.. Anyone know what options should be specified to get around these issues? I have the following zeromq software versions located as follows: C:\czmq-2.2.0 C:\zeromq-3.2.3 C:\zeromq-4.0.4 Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Trouble getting Paranoid Pirate and Majordomo patterns to function.
Dear zeromq developers, In recent weeks I've been trying to compile and run the Paranoid Pirate and Majordomo patterns. Failing to get the Paranoid pirate to work properly I moved onto the Majordomo pattern example. Sadly it was not possible to make that work either. Investigating further I came to suspect that in both cases the element of the pattern which was causing trouble was the REQ-ROUTER connection between the client program and the coordinating queue or broker. The ROUTER-DEALER connections appear to function and heartbeat nicely. There is more information regarding the environments I've tried at http://stackoverflow.com/questions/24597251/zeromq-issues-with-example-netwo rking-patterns-paranoid-pirate-and-majordomo?noredirect=1#comment38140118_24 597251 Does anyone know what could be wrong or how to fix it? With thanks, Riskybiz (aka GoFaster) ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Zeromq on virtualised linux instance.
I'm trying to run the zeromq Hello World programs, hwserver & hwclient, on a virtualized instance of Debian (Wheezy, 32 bit) running inside VirtualBox which itself is running on Windows 7. On running hwserver I get the error: Terminate called after throwing an instance of 'zmq::error_t' What(): Address already in use Aborted >From the zeromq reference http://api.zeromq.org/4-0:zmq-tcp I have tried all the different options shown in the examples to assign an address to the hwserver. Specifying various different port numbers each time. The error message always shows. Examples Assigning a local address to a socket // TCP port on all available interfaces rc = zmq_bind(socket, "tcp:/// :"); assert (rc == 0); // TCP port on the local loop-back interface on all platforms rc = zmq_bind(socket, "tcp://127.0.0.1:"); assert (rc == 0); // TCP port on the first Ethernet network interface on Linux rc = zmq_bind(socket, "tcp://eth0:"); assert (rc == 0); How should addresses be specified in zeromq when running on linux inside a virtual machine? Is it possible to establish zeromq communications between a program running on the host operating system (e.g. Windows 7) and a program running on the virtualised Debian machine? I'll test this once I can get an address for the communications! Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Paranoid Pirate Troubles
I’m using Visual Studio 2012 on Windows 7 and zeromq version 3.2.3 to build the Paranoid Pirate example http://zguide.zeromq.org/page:all#Robust- Reliable-Queuing-Paranoid-Pirate-Pattern with source code downloaded from GitHub a few days ago. There seems to be a problem running the ppqueue component in that the console window output is showing a random symbol where the ‘identity’ should be shown. I suspect that this may be symptomatic of a problem with ‘identities’ within the program. Paranoid Pirate Queue Output (ppqueue) E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready I read in the zeromq guide: http://zguide.zeromq.org/page:all#advanced- request-reply “As a historical note, ØMQ v2.2 and earlier use UUIDs as identities, and ØMQ v3.0 and later use short integers. There's some impact on network performance, but only when you use multiple proxy hops, which is rare. Mostly the change was to simplify building libzmq by removing the dependency on a UUID library.” In the send() and recv() functions in the zmsg.hpp header file I see that the UUIDs are decoded and encoded respectively. Could this be the source of the trouble I’m experiencing in trying to build the example. What would need to be changed to correct the program to use short integers as identities? With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Paranoid Pirate Troubles
I do have a Firewall running. I am able to run the Lazy Pirate Server and Lazy Pirate Client on the same computer and it functions as expected without the firewall getting in the way. Though I don't know how to test the connection with telnet. Riskybiz. Message: 12 Date: Thu, 26 Jun 2014 10:52:48 -0700 From: Michel Pelletier Subject: Re: [zeromq-dev] Paranoid Pirate Troubles To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="utf-8" Do you have a firewall running? Can you connect to your service from any process? (telnet, netcat, etc...) On Thu, Jun 26, 2014 at 10:40 AM, Riskybiz wrote: > I?m using Visual Studio Express 2012 to build the Paranoid Pirate Pattern > examples in Visual C++ on Windows. > > > > > http://zguide.zeromq.org/page:all#Robust-Reliable-Queuing-Paranoid-Pirate-Pa ttern > > > > Downloaded the example code from GitHub https://github.com/imatix/zguide/ > > > > My question is, has anyone managed to make the Paranoid Pirate Pattern in > C++ work on Windows? I get the following output from the components; > ppqueue, ppworker and lpclient. I?ve made a few minor code changes related > to the waiting/delay intervals to convert from seconds to milliseconds as > Sleep() in Visual C++ requires, and also a few necessities to get the code > to compile. After toying around with it for quite a while I thought I?d > ask: Anyone know how or managed to get this working?? Care to share? > > > > Thanks, > > > > Riskybiz. > > > > *ppqueue: N.B. the random symbols generated where the worker identity > should be.* > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > E: worker ? not ready > > > > *ppworker: can never reach the queue.* > > I: (07EC-4F30) worker ready > > I: (07EC-4F30) worker heartbeat > > W: (07EC-4F30) heartbeat failure, can't reach queue > > W: (07EC-4F30) reconnecting in 1000 msec... > > I: (87BC-56F4) worker ready > > I: (87BC-56F4) worker heartbeat > > I: (87BC-56F4) worker heartbeat > > I: (87BC-56F4) worker heartbeat > > W: (87BC-56F4) heartbeat failure, can't reach queue > > W: (87BC-56F4) reconnecting in 2000 msec... > > I: (1320-23FE) worker ready > > I: (1320-23FE) worker heartbeat > > I: (1320-23FE) worker heartbeat > > I: (1320-23FE) worker heartbeat > > W: (1320-23FE) heartbeat failure, can't reach queue > > W: (1320-23FE) reconnecting in 4000 msec... > > I: (5894-5F2C) worker ready > > > > *lpclient: doesn?t reach the server and gives up.* > > I: connecting to server... > > W: no response from server, retrying... > > I: connecting to server... > > W: no response from server, retrying... > > I: connecting to server... > > E: server seems to be offline, abandoning ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Paranoid Pirate Troubles
I’m using Visual Studio Express 2012 to build the Paranoid Pirate Pattern examples in Visual C++ on Windows. http://zguide.zeromq.org/page:all#Robust-Reliable-Queuing-Paranoid-Pirate- Pattern Downloaded the example code from GitHub https://github.com/imatix/zguide/ My question is, has anyone managed to make the Paranoid Pirate Pattern in C++ work on Windows? I get the following output from the components; ppqueue, ppworker and lpclient. I’ve made a few minor code changes related to the waiting/delay intervals to convert from seconds to milliseconds as Sleep() in Visual C++ requires, and also a few necessities to get the code to compile. After toying around with it for quite a while I thought I’d ask: Anyone know how or managed to get this working?? Care to share? Thanks, Riskybiz. ppqueue: N.B. the random symbols generated where the worker identity should be. E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker ↔ not ready E: worker Ø not ready E: worker Ø not ready E: worker Ø not ready E: worker Ø not ready E: worker ² not ready E: worker ² not ready E: worker ² not ready E: worker ² not ready E: worker ² not ready ppworker: can never reach the queue. I: (07EC-4F30) worker ready I: (07EC-4F30) worker heartbeat W: (07EC-4F30) heartbeat failure, can't reach queue W: (07EC-4F30) reconnecting in 1000 msec... I: (87BC-56F4) worker ready I: (87BC-56F4) worker heartbeat I: (87BC-56F4) worker heartbeat I: (87BC-56F4) worker heartbeat W: (87BC-56F4) heartbeat failure, can't reach queue W: (87BC-56F4) reconnecting in 2000 msec... I: (1320-23FE) worker ready I: (1320-23FE) worker heartbeat I: (1320-23FE) worker heartbeat I: (1320-23FE) worker heartbeat W: (1320-23FE) heartbeat failure, can't reach queue W: (1320-23FE) reconnecting in 4000 msec... I: (5894-5F2C) worker ready lpclient: doesn’t reach the server and gives up. I: connecting to server... W: no response from server, retrying... I: connecting to server... W: no response from server, retrying... I: connecting to server... E: server seems to be offline, abandoning ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] REQ to many REP.
I see in the 0MQ guide that it is possible to connect a single REQ socket to many REP sockets. I also read that DEALER to REP is a valid pattern. I have the impression that in both cases the sent messages would be DISTRIBUTED among the connected REP sockets, in a manner which is desirable for multithreading purposes but not necessarily for my scheme. I would need to have a message originate from REQ or DEALER and have it directed to a PARTICULAR REP socket of the several connected. Is this possible? I'm trying to cook up my own answer to a certain problem and am getting lost in the options that 0MQ presents! In the event that someone may be able to suggest a suitable 0MQ pattern to prevent me from reinventing the wheel I'll explain what I'm trying to do.. There will be several (flexible number) instances of time-series data source applications; it is important that data arrives in the order in which it was sent and nothing is lost/dropped enroute. Each time-series data source will control a REP socket and a PUSH socket. 0MQ message payloads will be custom boost::serialized object instances carrying port addresses, commands and data payloads. There will be a single instance of a separate data-collecting application which gathers all the data from all the sources. It will have a PULL socket and a REQ socket. Every PUSH socket will start out sending serialized "Hello from PUSH port 'n' " messages. When the PULL socket receives one of these "Hellos" it will trigger a message out of the REQ socket, back to the REP (address is specified in the "Hello") of the originating instance; that message will indicate the connection is established and allow the data source to switch over from "Hellos" and instead PUSH serialized data source payloads. The first data payload will be significant as it is the accumulated time-series data history; subsequent data payloads will be smaller real time updates. Some manner of heart beating / keep alive could / would be built in to this. Anyone have any suggestions on 0MQ patterns to implement this, perhaps a variation of what I propose or something altogether better? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] REQ to many REP.
I'd like to set up a 0MQ REQ-REP arrangement where there are many REP sockets connected to just one REQ socket. The actual number of REP sockets is unknown at design-time; however at run-time a list of the port addresses will be provided to the code running the REQ socket. What I'd like is that, somehow, the code running the solitary REQ socket will loop through the list of port addresses and connect to the multiple REP sockets as they bind and become available. Subsequently the REQ socket would work with (poll??) the established connections to send and receive messages as necessary. It's the first time I've tried this. Looking at the zmq_poll reference in the manual http://api.zeromq.org/3-2:zmq-poll it's unclear to me whether I can handle variable number of connections in an iterative manner. For example in: http://zguide.zeromq.org/cpp:mspoller the poll set is hard coded. Another question is can a REQ socket handle multiple connections? How best could a message be routed to the desired destination REP socket? Is some more advanced pattern necessary here ROUTER, BROKER?? What I'm trying to achieve is a REQ-REP flow to act as a command/control layer which will coordinate a PUSH-PULL socket pair. There will be a run-time flexible number of PUSH sockets but always just one PULL socket. Is anyone able to offer any guidance to clear my muddy thoughts on how to make this work? Am coding in C++. With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] How to send/receive a custom C++ object via zeromq.
I've managed to fix the problem and now am able to use boost::serialization to pass serialized data via zeromq. I've posted the test program code below in case it might be of use to someone else trying to do the same in future..There is a class declaration, a server program and a client program. The client makes a serialised request and the server sends a serialized message in reply. Thanks for help and guidance in getting this to work. Riskybiz. //Server //Intended to send a serialized object instance to a client #include #include #include #include #include #include #include "TestClass.h" int main () { //Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REP); socket.bind ("tcp://*:"); //Create a vector with some object instances std::vector testVec; for(unsigned int i = 0; i < 10; ++i) { std::string idStr = static_cast( &(std::ostringstream() << std::fixed << std::setprecision(0) << i))->str(); TestClass obj(i, "Test Message: " + idStr); testVec.push_back(obj); } while (true) { std::cout << "Server ready & waiting" << std::endl; zmq::message_t request; //Wait for next request from client socket.recv(&request); //Deserialize client request int index; //Cast the request data to a string std::string reqStr( static_cast(request.data()), request.size()); //Initialise istringstream with received serialized string data std::istringstream ibuffer(reqStr); //Initialise the archive boost::archive::text_iarchive iarchive(ibuffer); //Deserialize the archive into the variable iarchive & index; std::cout << "Client Requested Index: " << index << std::endl; //Prepare the reply std::ostringstream obuffer; //Initialise the archive boost::archive::text_oarchive oarchive(obuffer); //Serialise object at requested vector index oarchive & testVec.at(index); //Get the serialization data (a string) from the buffer std::string outStr(obuffer.str()); //Send data to client zmq::message_t reply(outStr.size()); memcpy((void *) reply.data(), outStr.data(), outStr.size()); socket.send(reply); std::cout << "Server Replied: " << outStr << std::endl; } return 0; } //Client //Intended to send a request to the server and receive, then deserialize an object #include #include #include #include #include #include #include "TestClass.h" int main () { // Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REQ); std::cout << "Connecting to server" << std::endl; socket.connect ("tcp://localhost:"); // Do 10 requests, waiting each time for a response for (int request_nbr = 0; request_nbr != 10; request_nbr++) { std::ostringstream obuffer; boost::archive::text_oarchive oarchive(obuffer); oarchive & request_nbr;//serialize the request std::string reqStr(obuffer.str());//Get the serialization data (a string) from the buffer zmq::message_t request(reqStr.size()); memcpy ((void *) request.data(), reqStr.data(), reqStr.size()); socket.send (request); std::cout << "Sent Request " << request_nbr << "" << std::endl; //Get the reply. zmq::message_t reply; socket.recv (&reply); //std::cout << "Received the reply" << std::endl; TestClass obj1; //std::cout << "Defined TestClass Object" << std::endl; std::string repStr( static_cast(reply.data()), reply.size() );//cast received message data to a string //std::cout << "Received Message: " << repStr << std::endl; std::istringstream ibuffer(repStr);//initialise with received serialized string data //std::cout << "Initialised buffer" << std::endl; boost::archive::text_iarchive iarchive(ibuffer); //std::cout << "Prepared archive" << std::endl; iarchive & obj1;//deserialise the archive into TestClass instance //std::cout << "Deserialized" << std::endl; //Check that data members of the deserialised object may be accessed std::cout << "Received: " << request_nbr << " ID: " << obj1.ID << " Message: " << obj1.text << std::endl; } return 0; } #ifndef TEST_CLASS_H #define TEST_CLASS_H //#include //#include //#include class TestClass { public: TestClass():ID(0), text("blank")//default constructor { } TestClass(const
[zeromq-dev] How to send/receive a custom C++ object via zeromq?
Trying to get to grips with how to serialize an object and send/receive it via zeromq I've modified the Hello World example from the zeromq documentation to try and achieve this. Code is below. Whilst the server appears to be outputting a sensible: Sent Reply: 22 serialization::archive 10 0 0 1 12 Test Message When this is received at the client end it is a jumbled mess of random characters. Does anyone know what I'm not doing correctly here? Thanks, Riskybiz. //Server //Intended to send a serialized object instance to a client #include #include #include #include #include "TestClass.h" int main () { //Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REP); socket.bind ("tcp://*:"); //Create an object instance and serialize it TestClass obj1(1, "Test Message"); std::ostringstream buffer; boost::archive::text_oarchive archive(buffer); archive & obj1;//serialize the object while (true) { zmq::message_t request; // Wait for next request from client socket.recv(&request); //Cast the request data to a string std::string reqStr( static_cast(request.data()), request.size() ); std::cout << "Received: " << reqStr << std::endl; // Do some 'work' Sleep(1000);//1000 millisecond pause std::string outStr(buffer.str());//Get the serialization data (a string?) from the buffer //Send data to client zmq::message_t reply(outStr.size()); memcpy((void *) reply.data(), &outStr, outStr.size()); socket.send(reply); std::cout << "Sent Reply: " << outStr << std::endl; } return 0; } //Client //Intended to send a request to the server and receive, then deserialize an object #include #include #include #include #include #include "TestClass.h" int main () { // Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REQ); std::cout << "Connecting to hello world server" << std::endl; socket.connect ("tcp://localhost:"); // Do 10 requests, waiting each time for a response for (int request_nbr = 0; request_nbr != 10; request_nbr++) { char req[] = "Hello"; zmq::message_t request (strlen(req)+1); memcpy ((void *) request.data (), req, strlen(req)+1); std::cout << "Sending Hello " << request_nbr << "" << std::endl; socket.send (request); // Get the reply. zmq::message_t reply; socket.recv (&reply); std::cout << "Received the reply" << std::endl; TestClass obj1; std::cout << "Instantiated TestClass Object" << std::endl; std::string repStr( static_cast(reply.data()), reply.size() );//cast received message data to a string std::cout << "Received Message: " << repStr << std::endl; std::istringstream buffer(repStr);//initialise with received serialized string data std::cout << "Initialised buffer" << std::endl; boost::archive::text_iarchive archive(buffer); std::cout << "Prepared archive" << std::endl; archive & obj1;//deserialise the archive into TestClass instance std::cout << "Deserialized" << std::endl; //Check that data members of the deserialised object may be accessed std::cout << "Received: " << request_nbr << " ID: " << obj1.ID << " Message: " << obj1.text << std::endl; } return 0; } //TestClass Definition #ifndef TEST_CLASS_H #define TEST_CLASS_H #include #include #include class TestClass { public: TestClass():ID(0), text("blank")//default constructor { } TestClass(const unsigned int id, const std::string txt):ID(id), text(txt)//constructor { } TestClass(const TestClass&);//copy constructor ~TestClass()//destructor { } const unsigned int ID; const std::string text; private: friend class boost::serialization::access; template void serialize(Archive& archive, const unsigned version) { archive & const_cast(ID) & const_cast(text); } };//class #endif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] How to send/receive a custom C++ object via zeromq
Thanks for the tips last week Bjorn. I like the idea of using boost::serialization. I've been looking at this blog to get familiar with the basics: http://www.ocoudert.com/blog/2011/07/09/a-practical-guide-to-c-serialization / All the simple examples I am able to find serialize the object to a file. I need to further understand how to serialize/deserialize an object and get it onto, across, and off the wire with zeromq. Might this involve serializing to a memory buffer? Hoped someone might be able to help with a HelloWorld demonstration of this? With thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] How to send/receive a custom C++ object via zeromq sockets?
So, I've got a working implementation of a zeromq REQ-REP socket pattern and am using it to pass data in the form of character strings between a server and several clients, like so: Sample comma separated data strings sent as a multipart message (of several thousand parts), each line is a complete instruction for the client to draw something on screen: 414,2095,@ESU13,upper,1,1,41528.600694,41528.602778,1679.75000,1679.75000,16 776960,3,0,1 415,2095,@ESU13,lower,1,1,41528.600694,41528.602778,1679.5,1679.5,16 776960,3,0,1 416,2095,@ESU13,marker,1,1,41528.602778,41528.602778,1679.75000,1680.5,1 6776960,3,0,0 417,2095,@ESU13,rectangle,1,1,41528.600694,41528.603472,1679.75000,1679.5000 0,65535,0,0,1 418,2095,@ESU13,label,1,1,41528.600694,1679.5,ID:2095 0.0149% 5Bars 100D 3.00IR,Arial,5.0,0,0 My issue is that each of the data strings has to be composed at the server and then decoded at the client end to extract the data; this works but is not very elegant, I'm sure there is a better and more efficient way... I have the notion that I'd like to try encapsulating each line of the data to be sent in a custom class object object instance; then serialize each object, pass it through the REQ-REP sockets and deserialise to reconstruct the object at the client end. The simple class would be in the format like so; only comprising data members. class Instruction { public: //Constructor Instruction(const unsigned int &intData, const double &dblData, const std::string &strData): IntData(intData), DblData(dblData), StrData(strData) { } //Data Members const unsigned int IntData; const double DblData; const std::string StrData; };//class Trouble is I don't know how to implement this practically. Is anyone able to provide a simple example of how to accomplish serialising and deserialising a custom object and sending it though a REQ-REP socket pair? Or does anyone know of a good online tutorial on this subject? I'm working with Visual Studio 2012 Express in C++. With very many thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Access ZeroMQ Error Messages in C++?
So I've worked out how to get ZeroMQ error messages like so: int rc = zmq_bind(server, "tcp://*:"); if(rc == -1) { std::string errStr = zmq_strerror(zmq_errno()); std::string errConc = "TestDataAccess: ZMQServer: Bind To REP Failed: " + errStr; const char* errOut = errConc.c_str(); OutputDebugStringA(errOut); return 1; } Question is; how do I catch ZeroMQ error messages in C++; say if I wanted to use: client.connect("tcp://localhost:"); the obvious way I tried: int rc = client.connect("tcp://localhost:"); is just not valid because; client.connect("tcp://localhost:"); returns type 'void'. Can anyone provide a quick C++ example of how to accomplish this? Thanks, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] FW: ZeroMQ Error when client starts first, server second. SOLVED.
>"No. Your code thinks it's in the last iteration and sends without SNDMORE - but then the vector grows and it tries to add another frame afterwards and fails." Christian, absolutely brilliant how you zeroed in on the problem. Thanks, your comments made me think a little differently. The vector is growing as the server is composing messages. I fixed the error by breaking the 'for' loop which composes the multipart message whenever the 'end' iterator is detected and the final part is sent; so preventing any extra message frame with the incorrect ZMQ_SNDMORE flag. Your suggestion of only reading the end() iterator once for each message composition loop would also give a very tidy result I think. Thanks again, Riskybiz. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] ZeroMQ Cleaning up?
So I've built a C++ DLL to integrate with a third party application on Windows 7 using Visual Studio 2012. The DLL has two functions to manage a ZeroMQ `hello world` server (from the ZeroMQ guide document). One function to CREATE and launch the server in a separate thread, the other DESTROY function to interrupt the server and terminate the thread. All goes well, the server is started by CREATE and I can communicate with it using 'hello world' client (again from the ZeroMQ guide document). The problem I need to solve appears after DESTROY is called: When DESTROY is called all seems well initially, the third party application remains responsive; however if I run hello world client again (in the knowledge that the server should have gone!) then it causes the third party application to crash. This makes me suspect that the ZeroMQ resources are not being released/destroyed properly, this is further complicated by uncertainty as to whether the error thrown by boost::this_thread::interruption_point() is being caught or not and consequently whether my ZeroMQ clean up routine is called (I don't get any output from the catch block to confirm this). I've posted to the Boost mailing list also on this subject. Question is: this is a simple interpretation of the 'hello world' server in a DLL; should it be necessary to carry out additional measures to clean up resources such as: socket.close();//Close socket for orderly exit zmq_ctx_destroy(context);//When you exit the program, close your sockets and then call zmq_ctx_destroy(). This destroys the context. given that these clean up instructions are not necessary in the ZeroMQ exe implementations of `hello world` server. Have I correctly implemented the instructions to create and terminate the ZeroMQ sockets & communications in this code? Any suggestions for a way around this problem? With thanks, Riskybiz. static bool createCalled = false;//initialise static variable static bool destroyCalled = false;//initialise static variable static boost::thread *serverThread = nullptr; int __stdcall CREATE() { if(createCalled == false) { createCalled = true; OutputDebugStringA("TestDataAccess: CREATE"); serverThread = new boost::thread(ListenOnReplySocket);//create instance of boost::thread object return 0; } return 1; } int __stdcall DESTROY() { if(createCalled == true && destroyCalled == false) { destroyCalled = true; OutputDebugStringA("TestDataAccess: DESTROY"); serverThread->interrupt();//set flag for interruption delete serverThread; return 0; } return 1; } Server code: #ifndef ZMQ_COMMUNICATIONS_H//if not defined already #define ZMQ_COMMUNICATIONS_H//then define it #define _WINSOCK2API_ //stops windows.h including winsock2.h #include #include "boost\thread.hpp" #include void ListenOnReplySocket() { // Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REP); socket.bind ("tcp://*:"); // Configure socket to not wait at close time int linger = 0; socket.setsockopt (ZMQ_LINGER, &linger, sizeof (linger)); //Enable thread interruption boost::this_thread::interruption_enabled(); try { while (true) { zmq::message_t request; // Wait for next request from client socket.recv (&request); char buffer[50]; int j; j = sprintf_s(buffer, 50, "TestDataAccess: ZMQComms: Hello"); OutputDebugStringA(buffer); // Do some 'work' Sleep (1000); // Send reply back to client zmq::message_t reply (5); memcpy ((void *) reply.data (), "World", 5); socket.send (reply); boost::this_thread::interruption_point();//check iterruption flag } } catch(boost::thread_interrupted &bti) { socket.close();//Close socket for orderly exit zmq_ctx_destroy(context);//When you exit the program, close your sockets and then call zmq_ctx_destroy(). This destroys the context. char buffer1[100]; int s; s = sprintf_s(buffer1, 100, "TestDataAccess: ZMQComms: Server Thread Interrupted"); OutputDebugStringA(buffer1); } } #endif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Errors creating a DLL including ZeroMQ
Shon, the link you provided: http://stackoverflow.com/questions/1372480/c-redefinition-header-files was golden! It said, amongst other things to add this line: #define _WINSOCKAPI_ //to stop windows.h including winsock.h I extrapolated that to this line, as my errors related to winsock2.h: #define _WINSOCK2API_ //stops windows.h including winsock2.h And bingo, success, the DLL file built without errors and I was able to demonstrate ZeroMQ client-server communications. Many thanks & all the best, Riskybiz. -Original Message- From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev-boun...@lists.zeromq.org] On Behalf Of zeromq-dev-requ...@lists.zeromq.org Sent: 18 July 2013 11:00 To: zeromq-dev@lists.zeromq.org Subject: zeromq-dev Digest, Vol 67, Issue 18 Send zeromq-dev mailing list submissions to zeromq-dev@lists.zeromq.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.zeromq.org/mailman/listinfo/zeromq-dev or, via email, send a message with subject or body 'help' to zeromq-dev-requ...@lists.zeromq.org You can reach the person managing the list at zeromq-dev-ow...@lists.zeromq.org When replying, please edit your Subject line so it is more specific than "Re: Contents of zeromq-dev digest..." Today's Topics: 1. Re: Errors creating a DLL including ZeroMQ (Riskybiz) 2. Re: Errors creating a DLL including ZeroMQ (Shon Love) -- Message: 1 Date: Wed, 17 Jul 2013 15:02:51 +0100 From: Riskybiz Subject: Re: [zeromq-dev] Errors creating a DLL including ZeroMQ To: Message-ID: Content-Type: text/plain; charset="us-ascii" Shon, are you able to expand on that please? "Hey, I'm guessing you need to link your dll against the 'ws2_32.lib' library. Thanks, Shon" I found the WS_32.lib file here: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\WS_32.lib And tried to link it under Project Properties like so: Linker->General->Additional Library Dependencies-> C:\Program Files (x86)\Boost\boost_1_53_0\stage\lib; C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\WS_32.lib; C:\zeromq-3.2.3\lib\Win32 Also tried: Linker->Input->AdditionalDependencies-> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\WS2_32.lib C:\zeromq-3.2.3\lib\Win32\libzmq.lib Still getting a mass of errors on trying to build. Thanks, RiskyBiz _ Date: Tue, 16 Jul 2013 15:30:30 -0600 From: Shon Love Subject: Re: [zeromq-dev] Errors creating a DLL including ZeroMQ libraries To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="windows-1252" Hey, I'm guessing you need to link your dll against the 'ws2_32.lib' library. Thanks, Shon On Tue, Jul 16, 2013 at 3:18 PM, Riskybiz wrote: > I?m creating a C++ DLL using Visual Studio 2012 and would like to use > ZeroMQ libraries in it. I?ve basically taken the ZeroMQ example ?hwserver? > Hello World Server and adapted it into a header file for use within my > DLL (Code below). Problem is that I get hundreds of warnings and > errors when trying to build the DLL; the errors are repetitious > referring to many different elements of the same header files: > > ** ** > > Winsock2.h ???redeclaration cannot add dllexport/dllimport??? > > winsock2.h Macro redefinitions. > > ws2def.h type redefinitions > > ** ** > > etc etc etc??.. > > ** ** > > and sample errors below: > > ** ** > > Warning 26 warning C4005: 'SOMAXCONN' : macro > redefinition C:\Program Files (x86)\Windows > Kits\8.0\Include\um\winsock2.h 506 1 TestDataAccess** > ** > > ** ** > > 125 IntelliSense: redeclaration cannot add dllexport/dllimport to > "WSAUnhookBlockingHook" (declared at line 879 of "C:\Program Files > (x86)\Windows Kits\8.0\Include\um\winsock.h")c:\Program Files > (x86)\Windows Kits\8.0\Include\um\WinSock2.h 2381 > 1 TestDataAccess > > ** ** > > 79 IntelliSense: expected an identifier c:\Program Files > (x86)\Windows Kits\8.0\Include\shared\ws2def.h 414 > 5 TestDataAccess > > ** ** > > Error 63 error C2375: 'WSAStartup' : redefinition; > different linkageC:\Program Files (x86)\Windows > Kits\8.0\Include\um\winsock2.h 2296 1
Re: [zeromq-dev] Errors creating a DLL including ZeroMQ
Shon, are you able to expand on that please? "Hey, I'm guessing you need to link your dll against the 'ws2_32.lib' library. Thanks, Shon" I found the WS_32.lib file here: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\WS_32.lib And tried to link it under Project Properties like so: Linker->General->Additional Library Dependencies-> C:\Program Files (x86)\Boost\boost_1_53_0\stage\lib; C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\WS_32.lib; C:\zeromq-3.2.3\lib\Win32 Also tried: Linker->Input->AdditionalDependencies-> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\WS2_32.lib C:\zeromq-3.2.3\lib\Win32\libzmq.lib Still getting a mass of errors on trying to build. Thanks, RiskyBiz _ Date: Tue, 16 Jul 2013 15:30:30 -0600 From: Shon Love Subject: Re: [zeromq-dev] Errors creating a DLL including ZeroMQ libraries To: ZeroMQ development list Message-ID: Content-Type: text/plain; charset="windows-1252" Hey, I'm guessing you need to link your dll against the 'ws2_32.lib' library. Thanks, Shon On Tue, Jul 16, 2013 at 3:18 PM, Riskybiz wrote: > I?m creating a C++ DLL using Visual Studio 2012 and would like to use > ZeroMQ libraries in it. I?ve basically taken the ZeroMQ example ?hwserver? > Hello World Server and adapted it into a header file for use within my > DLL (Code below). Problem is that I get hundreds of warnings and > errors when trying to build the DLL; the errors are repetitious > referring to many different elements of the same header files: > > ** ** > > Winsock2.h ???redeclaration cannot add dllexport/dllimport??? > > winsock2.h Macro redefinitions. > > ws2def.h type redefinitions > > ** ** > > etc etc etc??.. > > ** ** > > and sample errors below: > > ** ** > > Warning 26 warning C4005: 'SOMAXCONN' : macro > redefinition C:\Program Files (x86)\Windows > Kits\8.0\Include\um\winsock2.h 506 1 TestDataAccess** > ** > > ** ** > > 125 IntelliSense: redeclaration cannot add dllexport/dllimport to > "WSAUnhookBlockingHook" (declared at line 879 of "C:\Program Files > (x86)\Windows Kits\8.0\Include\um\winsock.h")c:\Program Files > (x86)\Windows Kits\8.0\Include\um\WinSock2.h 2381 > 1 TestDataAccess > > ** ** > > 79 IntelliSense: expected an identifier c:\Program Files > (x86)\Windows Kits\8.0\Include\shared\ws2def.h 414 > 5 TestDataAccess > > ** ** > > Error 63 error C2375: 'WSAStartup' : redefinition; > different linkageC:\Program Files (x86)\Windows > Kits\8.0\Include\um\winsock2.h 2296 1 TestDataAccess*** > * > > ** ** > > ** ** > > I?ve already experimented with the ZeroMQ examples ?hwserver? Hello > World Server & `hwclient` Hello World Client. I can get the exe > application files for these examples to build and run OK on my PC > (Same machine as I?m using for the DLL). > > ** ** > > ** ** > > It?s clear that something is significantly wrong here; does anyone > know what it could be? Or what steps are needed to build a DLL in > Visual Studio > 2012 using the ZeroMQ libraries. (Note: I?ve used Boost libraries in > the same manner, for a DLL, without all this trouble!) > > ** ** > > ** ** > > Hope you can help, > > ** ** > > With thanks, > > ** ** > > Riskybiz. > > ** ** > > Code I?m trying to build in a DLL: > > ** ** > > ** ** > > #ifndef ZMQ_COMMUNICATIONS_H//if not defined already > > #define ZMQ_COMMUNICATIONS_H//then define it > > > > #include > > > > void ListenOnReplySocket() > > { > > // Prepare our context and socket > > zmq::context_t context (1); > > zmq::socket_t socket (context, ZMQ_REP); > > socket.bind ("tcp://*:"); > > > > while (true) > > { > > zmq::message_t request; > > > > // Wait for next request from client > > socket.recv (&request); > >
[zeromq-dev] Errors building a DLL which includes ZeroMQ (0MQ) functionality.
I'm creating a C++ DLL using Visual Studio 2012 and would like to use ZeroMQ functionality in it. I've basically taken the ZeroMQ example 'hwserver' Hello World Server and adapted it into a header file for use within my DLL (Code below). Problem is that I get hundreds of warnings and errors when trying to build the DLL; the errors are repetitious referring to many different elements of the same header files: Winsock2.h ...redeclaration cannot add dllexport/dllimport... winsock2.h Macro redefinitions. ws2def.h type redefinitions etc etc etc and sample errors below: Warning 26 warning C4005: 'SOMAXCONN' : macro redefinition C:\Program Files (x86)\Windows Kits\8.0\Include\um\winsock2.h 506 1 TestDataAccess 125 IntelliSense: redeclaration cannot add dllexport/dllimport to "WSAUnhookBlockingHook" (declared at line 879 of "C:\Program Files (x86)\Windows Kits\8.0\Include\um\winsock.h")c:\Program Files (x86)\Windows Kits\8.0\Include\um\WinSock2.h 2381 1 TestDataAccess 79 IntelliSense: expected an identifier c:\Program Files (x86)\Windows Kits\8.0\Include\shared\ws2def.h 4145 TestDataAccess Error 63 error C2375: 'WSAStartup' : redefinition; different linkageC:\Program Files (x86)\Windows Kits\8.0\Include\um\winsock2.h 2296 1 TestDataAccess I've already experimented with the ZeroMQ examples 'hwserver' Hello World Server & `hwclient` Hello World Client. I can get the exe application files for these examples to build and run OK on my PC (Same machine as I'm using for the DLL). It's clear that something is significantly wrong here; does anyone know what it could be? Or what steps are needed to build a DLL in Visual Studio 2012 using the ZeroMQ libraries. (Note: I've used Boost libraries in the same manner, for a DLL, without all this trouble!) Hope you can help, With thanks, Riskybiz. Code I'm trying to build in a DLL: #ifndef ZMQ_COMMUNICATIONS_H//if not defined already #define ZMQ_COMMUNICATIONS_H//then define it #include void ListenOnReplySocket() { // Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REP); socket.bind ("tcp://*:"); while (true) { zmq::message_t request; // Wait for next request from client socket.recv (&request); char buffer[50]; int j; j = sprintf_s(buffer, 50, "TestDataAccess: ZMQComms: Hello"); OutputDebugStringA(buffer); // Do some 'work' Sleep (1); // Send reply back to client zmq::message_t reply (5); memcpy ((void *) reply.data (), "World", 5); socket.send (reply); } } #endif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] Errors creating a DLL including ZeroMQ libraries
I'm creating a C++ DLL using Visual Studio 2012 and would like to use ZeroMQ libraries in it. I've basically taken the ZeroMQ example 'hwserver' Hello World Server and adapted it into a header file for use within my DLL (Code below). Problem is that I get hundreds of warnings and errors when trying to build the DLL; the errors are repetitious referring to many different elements of the same header files: Winsock2.h ...redeclaration cannot add dllexport/dllimport... winsock2.h Macro redefinitions. ws2def.h type redefinitions etc etc etc and sample errors below: Warning 26 warning C4005: 'SOMAXCONN' : macro redefinition C:\Program Files (x86)\Windows Kits\8.0\Include\um\winsock2.h 506 1 TestDataAccess 125 IntelliSense: redeclaration cannot add dllexport/dllimport to "WSAUnhookBlockingHook" (declared at line 879 of "C:\Program Files (x86)\Windows Kits\8.0\Include\um\winsock.h")c:\Program Files (x86)\Windows Kits\8.0\Include\um\WinSock2.h 2381 1 TestDataAccess 79 IntelliSense: expected an identifier c:\Program Files (x86)\Windows Kits\8.0\Include\shared\ws2def.h 4145 TestDataAccess Error 63 error C2375: 'WSAStartup' : redefinition; different linkageC:\Program Files (x86)\Windows Kits\8.0\Include\um\winsock2.h 2296 1 TestDataAccess I've already experimented with the ZeroMQ examples 'hwserver' Hello World Server & `hwclient` Hello World Client. I can get the exe application files for these examples to build and run OK on my PC (Same machine as I'm using for the DLL). It's clear that something is significantly wrong here; does anyone know what it could be? Or what steps are needed to build a DLL in Visual Studio 2012 using the ZeroMQ libraries. (Note: I've used Boost libraries in the same manner, for a DLL, without all this trouble!) Hope you can help, With thanks, Riskybiz. Code I'm trying to build in a DLL: #ifndef ZMQ_COMMUNICATIONS_H//if not defined already #define ZMQ_COMMUNICATIONS_H//then define it #include void ListenOnReplySocket() { // Prepare our context and socket zmq::context_t context (1); zmq::socket_t socket (context, ZMQ_REP); socket.bind ("tcp://*:"); while (true) { zmq::message_t request; // Wait for next request from client socket.recv (&request); char buffer[50]; int j; j = sprintf_s(buffer, 50, "TestDataAccess: ZMQComms: Hello"); OutputDebugStringA(buffer); // Do some 'work' Sleep (1); // Send reply back to client zmq::message_t reply (5); memcpy ((void *) reply.data (), "World", 5); socket.send (reply); } } #endif ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] Using ZeroMQ in VS2012 C++
Im trying to build the Hello World server example from the ZeroMQ guide documentation using Visual Studio 2012 C++. Im having trouble getting the project to link properly. The zmq.h header file is found (note: not zmq.hpp as in the example code) but the particular zeromq commands remain underlined in red by intellisense. Something is not being recognised properly. Have tried both the Windows MSI install package and also building the binary code directly on my machine neither approach made any difference. I see that Shon Love recommended the following a few days ago on this mailing list: 1. Add the path to 0mq's 'include' folder to your project's include path. 2. Add the path to 0mq's 'lib' folder to your project's additional library path. 3. Add the libzmq.lib file to the list of additional libraries your exe will link against. 4. Make sure the libzmq.dll file is in the PATH for your application's exe when it is run. For debugging, I often copy the appropriate .dll file into the build folder for the application, but installing the libzmq*.dll files into the normal execution path works, too. Hope you can make sense of any of that :) Thanks, Shon Using my newly built ZeroMQ binaries Ive got my project properties set like so: 1. C/C++->General->Additional Include Directories : C:\zeromq-3.2.3\include 2. Linker->General->Additional Library Directories : C:\zeromq-3.2.3\lib\Win32 3. Linker->Input->Additional Dependencies: C:\zeromq-3.2.3\lib\Win32\libzmq.lib 4. Placed the libzmq.dll into the projects release folder. Does anyone know what could be wrong here?? João Pereira, did you get your ZeroMQ project to build on Visual Studio 2012? If so how did you do it? With thanks, Riskybiz ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev