mtserver | Example code from my Multithreaded Work Queue Based Server | Application Framework library

 by   vichargrave C++ Version: Current License: No License

kandi X-RAY | mtserver Summary

kandi X-RAY | mtserver Summary

mtserver is a C++ library typically used in Server, Application Framework applications. mtserver has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

Example code from my Multithreaded Work Queue Based Server in C++ blog.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              mtserver has a low active ecosystem.
              It has 14 star(s) with 14 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 1 have been closed. On average issues are closed in 1157 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of mtserver is current.

            kandi-Quality Quality

              mtserver has no bugs reported.

            kandi-Security Security

              mtserver has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              mtserver does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              mtserver releases are not available. You will need to build from source code and install.
              Installation instructions are available. Examples and code snippets are not available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mtserver
            Get all kandi verified functions for this library.

            mtserver Key Features

            No Key Features are available at this moment for mtserver.

            mtserver Examples and Code Snippets

            No Code Snippets are available at this moment for mtserver.

            Community Discussions

            QUESTION

            Crash in a modified version of an official ZeroMQ mutithreaded example
            Asked 2019-Sep-15 at 14:01

            I'm new to zmq and cppzmq. While trying to run the multithreaded example in the official guide: http://zguide.zeromq.org/cpp:mtserver

            My setup

            • macOS Mojave, Xcode 10.3
            • libzmq 4.3.2 via Homebrew
            • cppzmq GitHub HEAD

            I hit a few problems.

            Problem 1

            When running source code in the guide, it hangs forever without any stdout output shown up.

            Here is the code directly copied from the Guide.

            ...

            ANSWER

            Answered 2019-Sep-14 at 08:48
            Welcome to the domain of the Zen-of-Zero

            Suspect #1: the code jumps straight into an unresolveable live-lock due to a move into ill-directed state of the distributed-Finite-State-Automaton:

            While I since ever advocate for preferring non-blocking .recv()-s, the code above simply commits suicide right by using this step:

            socket.recv( request, zmq::recv_flags::dontwait ); // socket being == ZMQ_REP

            kills all chances for any other future life but the very error The zmq_send() operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state.
            as
            going into the .send()-able state is possible if and only if a previous .recv()-ed has delivered a real message.

            The Best Next Step :

            Review the code and may either use a blocking-form of the .recv() before going to .send() or, better, use a { blocking | non-blocking }-form of .poll( { 0 | timeout }, ZMQ_POLLIN ) before entering into an attempt to .recv() and keep doing other things, if there is nothing to receive yet ( so as to avoid the self suicidal throwing the dFSA into an uresolvable collision, flooding your stdout/stderr with a second-spaced flow of printf(" ERROR: %X\n", e.num() ); )

            Error Handling :

            Better use const char *zmq_strerror ( int errnum ); being fed by int zmq_errno (void);

            The Problem 1 :

            On the contrary to the suicidal ::dontwait flag in the Problem 2 root cause, the Problem 2 root cause is, that a blocking-form of the first .recv() here moves all the worker-threads into an undeterministically long, possibly infinite, waiting-state, as the .recv()-blocks proceeding to any further step until a real message arrives ( which it does not seem from the MCVE, that it ever will ) and so your pool-of-threads remains in a pool-wide blocked-waiting-state and nothing will ever happen until any message arrived.

            Update on how the REQ/REP works :

            The REQ/REP Scalable Communication Pattern Archetype works like a distributed pair of people - one, let's call her Mary, asks ( Mary .send()-s the REQ ), while the other one, say Bob the REP listens in a potentially infinitely long blocking .recv() ( or takes a due care, using .poll() to orderly and regularly check, if Mary has asked about something or not and continues to do his own hobbies or gardening otherwise ) and once the Bob's end gets a message, Bob can go and .send() Mary a reply ( not before, as he knows nothing when and what Mary would ( or would not ) ask in the nearer of farther future ) ) and Mary is fair not to ask her next REQ.send()-question to Bob anytime sooner but after Bob has ( REP.send() ) replied and Mary has received Bob's message ( REQ.recv() ) - which is fair and more symmetric, than a real life may exhibit among real people under one roof :o)

            The code?

            The code is not a reproducible MCVE. The main() creates five Bobs ( hanging waiting a call from Mary, somewhere over inproc:// transport-class ), but no Mary ever calls, or does she? Not visible sign of any Mary trying to do so, the less her ( their, could be a (even a dynamic) community of N:M herd-of-Mary(s):herd-of-5-Bobs relation ) attempt(s) to handle REP-ly(s) coming from either one of the 5-Bobs.

            Persevere, ZeroMQ took me some time of scratching my own head, yet the years after I took a due care to learn the Zen-of-Zero are still a rewarding eternal walk in the Gardens of Paradise. No localhost serial-code IDE will ever be able to "debug" a distributed-system (unless a distributed-inspector infrastructure is inplace, a due architecture for a distributed-system monitor/tracer/debugger is another layer of distributed messaging/signaling layer atop of the debugged distributed messaging/signaling system - so do not expect it from a trivial localhost serial-code IDE.

            If still in doubts, isolate potential troublemakers - replace inproc:// with tcp:// and if toys do not work with tcp:// (where one can wire-line trace the messages) it won't with inproc:// memory-zone tricks.

            Source https://stackoverflow.com/questions/57920141

            QUESTION

            0MQ: on passing a context to a pool of threads a Segmentation fault was thrown
            Asked 2017-May-25 at 10:35

            I am building a small program (here), in which the main() sends the same msg to all worker threads and the worker threads simply print the msg.

            I think I have exactly followed this tutorial, from the official guide.

            I pass the 0MQ context to thread via a void pointer and then cast it back to zmq::context_t *. But still I got the Segmentation fault. Below is info from coredump in GDB:

            ...

            ANSWER

            Answered 2017-May-25 at 08:25
            pool.push_back(thread(task1, (void *)context));
            

            Source https://stackoverflow.com/questions/44175460

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install mtserver

            Get the threads code.
            Get the work queue code.
            Get the TCP sockets code.
            Place the mtserver, threads, wqueue and tcpsockets directories at the same directory level, e.g. ${HOME}/src/mtserver, ${HOME}/src/threads, ${HOME}/src/wqueue and ${HOME}/src/tcpsockets.
            cd to ${HOME}/src/mtserver.
            Build the test client and server applications by running make.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/vichargrave/mtserver.git

          • CLI

            gh repo clone vichargrave/mtserver

          • sshUrl

            git@github.com:vichargrave/mtserver.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Application Framework Libraries

            Try Top Libraries by vichargrave

            tcpsockets

            by vichargraveC++

            wqueue

            by vichargraveC++

            threads

            by vichargraveC++

            sniffer

            by vichargraveC

            espcap

            by vichargravePython