Is there a popular C++ service framework? - c++

... like Remoting or WCF in C# or Java RMI?
I am learning c++ and need a simple to use tcp service framework with built in binary serialization for c++ to c++ communication.
Thanks

Apache Thrift or Google's Protocol Buffers are probably the two that will suit your needs the best.

I think you will have to drop the 'simple' part. Try Corba (portable) or DCOM (almost only Windows).

You could use boost MPI but it's quite complex, however library for use in distributed-memory parallel application programming.
You could use more simpler solution for c++, implementing your own dispatchers using ie. protocol-buffers from google or even json. Then parsing it using some design patterns like 'command' to execute some methods.

Related

Library for developing XMPP server in c++ or delphi?

I have to develop a simple XMPP server that will be included in a commercial project. I guess there is no server available that can be purchased with a royalty-free-license and that enables me to do the configuration and user management and the authentication from my own code.
The languages I can use are Delphi and C++.
I've already looked at the libraries listed at xmpp.org, but most of them seem to be client-only libraries or (as e.g. QXmpp) require QT which I have no experience of and consideres it to be a pure GUI framework.
Can anybody suggest a library I should take a closer look at? Does it make sense to familiarize myself with QT for this purpose (writing xmpp server;no GUI)?
Or is it better to just catch a stream parser (suggestions?) and code it myself?
Thanks!
Edit: The only library I could find for Delphi, IP*Works is a pure client library. I'm evaluation QXmpp now.
For the Delphi part of my question: I didn't find a library I think that is suitable for building a server.
For the C++ part, I think this post Non GPL C/C++ XMPP client library for embedded Linux (though it is for embedded and client) is answering my questions:
Because Qt provides XML parser and signal/slot framework. XMPP requires XML parser, and signal/slot framework makes your life easier. If you try implementing entire XMPP with all extensions in OOP fashion, you'll need something similar to Qt.
and
Advice: when it comes to C++, there aren't many good xmpp libraries available.
So I think, QXmpp seems to be a good solution.
For other people searchig for this topic:
IMHO the documentation (especially for the server part) is a bit poor. The server example distributed with the qxmpp library is (of course) very basic: It is transporting chat messages. Distributing presence information, roster, subscription handling has to be implemented by you via extensions (inheriting QXmppServerExtension overwriting at least virtual function handleStanza). Don't parse the presence or iq stanzas in your own code. For the more common stanzas the libarary has classes implemented QXmppPresence, QXmppRosterIq etc.) that also can be used in your extension.

How to write c++ spout/bolt on Storm and Thrift usage in Storm

From here:
Storm was designed from the very beginning to be compatible with multiple languages. Nimbus is a Thrift service and topologies are defined as Thrift structures. The usage of Thrift allows Storm to be used from any language.
I see that a topology created in java get deployed by serializing the topology (spouts, bolts , ComponentCommon) as a Thrift datatypes and then gets deployed on Nimbus. In Java it is easy to serialize the object with its methods and data. So on the other side Nimbus just needs to create objects and invoke them. (i might be missing detail here but I hope I got the point correctly)
But I wonder how to write the topology in C++ and deploy it the same way. Does thrift help to serialize the c++ based topology and Nimbus deploys/executes the topology in the same way as for Java?
I have seen the links link1 link2 in this regard and the only solution seems to be using a Shelbolt. which invokes the process and communicates with it over standard i/o.
In order to use the Thrift way, do we need to rewrite the storm core also in C++? Also why use Thrift when it supports only JVM languages? Thrift doesn't seem to be used at all for languages like python/c++.
I'm not sure if I'm understand your question correctly -- in my understanding you're asking Is it possible [without the Shebolt hack] to use Storm [with Thrift as comm protocol] with C++-written bolts and with C++ as the language that creates the topology.
Because of the lack of other answers to this question and based on my own research I assume there is no finished, usable implementation for your problem.
Therefore if you really have to use Storm (its common usecase is the JVM, so even if it could theoretically work with any language, it doesn't mean there is an ecosystem for other languages) and C++, you have no option but to use the Shebolt hack or modify Thrift yourself.
As you know, thrift itself has also been ported to C++. Therefore it is possible to re-build the API calls in C++. Basically, you'd need to port the Java TopologyBuilder. On the C++ side, you could start with the Thrift C++ tutorial.
This is also some kind of a hack, as you basically just rebuild half of the stack (in this case ontop of Thrift), but in general you have very few other options with a system design like Storm.
For example, the MySQL binary protocol has been rebuilt from-scr
Unless anyone has done the work for you (which I would have completely missed in my research) I see no option than to do it yourself (maybe even storm is not the best tool for your usecase!?)
If another hack (which might be even more complex and maybe even slower) besides ShellBolt is good enough for you, you could try starting a JVM from inside C++, e.g. see this SO post. I would not recommend this.
If you need an alternative distributed task queue, I have had good experience with Celery in Python environments, however I have no experience in using it in C++ directly (I usually control Python with ZeroMQ, or write my own ZeroMQ-based queues where necessary, but this is no universal solution).

Scalable server framework in C++

I am looking to write a server application in C++ that is meant to handle tens of thousands of clients simultaneously. It should run under Windows and Linux. I have been looking around for frameworks and libraries and have come across Boost Asio, which seems like a highly mature and widely used alternative. I just have trouble wrapping my head around strands/thread pools, mainly because of the millions of templates. My background is mainly in C, so am not really used to the template mess that Boost in general seems to be full of. I tried to find someone to develop a relatively thin wrapper around Boost Asio that would take care of the threading/synchronization aspect using strands, bind and the like, but have been unable to find someone yet who can do it within my budget (2 or 300 US dollars).
Can any of you recommend any other libraries that scale as well as Boost Asio (e.g. with IOCP on Windows and epoll on Linux etc), or a source where I might find skilled Boost developers looking for smaller freelance jobs?
Thanks very much in advance for any help.
Kind regards,
Philip Bennefall
Best 4 choices i know
I really like zeromq.. but libuv seems interesting.. (libev and libevent are very nice too)
zeromq
libevent (as said)
libev
libuv (Its purpose is to abstract
IOCP on windows and libev on Unix systems and it is node.js network layer)
ACE is the framework you are looking for. Even boost Asio is just an implementation of Proactor pattern, which was introduced by Douglas C. Schmidt. He is best known as the author of POSA Vol.2 and the creator of ACE framework.
The Boost.Asio library offers side-by-side support for synchronous
and asynchronous operations ... based on the Proactor design pattern
[POSA2].
Although it is a cross-platform C++ network framework and uses template,
just simple template is used. (or not at all)
My background is mainly in C, too, and I don't like Boost's massive template-programming style. However, ACE wasn't like that.
Try libevent on for size. Its whole raison d'etre is to address the C10K problem. I'd say it's probably more lightweight than boost.
Try Pulsar Server Framework. Main benefit is it is built over libuv network library (used by node.js) that uses asynchronous I/O based on event loops.
It’s perfectly scalable. You can just go adding servers as your user base increases.
It is designed to work with server farm.
Highly configurable and easy to use
Currently it has been built for Windows x64 server.

Network programming using C++

How can we do network programming in C++ similar to Remoting in .NET? Please help with any tutorials.
It would be fine if I know how to enable two computers to communicate in the form of sending and receiving messages using C++/C#.
Thanks,
Rakesh.
For windows, you can check out this.
You could refer Beej's guide for Unix flavors.
C++ does not have any native networking libraries, so if you don't want to use OS specific calls, you are going to need to use a portability layer.
Two that come to mind are Boost ASIO and ACE.
You may want to have a look at the Poco C++ libraries. Especially the Net module.
For a pure C++ solution (as your first sentence suggests) that's also really simple to use, checkout RCF.
If you want to communicate between C# and C++ programs (as your second sentence suggests) you'll have to look elsewhere, sorry.
Check out our C++ Remoting framework. There's also a screencast showing how to use it.
This is probably the closest that you'll get to .NET Remoting in C++.

What is the best way to access SOAP WebServices from portable native code?

I need to access a SOAP webservice (written in .NET with MS SQL backend, FWIW) from several different platforms, so my common denominator is native C++. Is there a portable library for this or I should roll my own solution?
To do SOAP in C++ you need both a networking and an XML/SOAP library. These aren't easy to find, especially if cross-platform is needed.
I would start from libcurl. There seems to be a SOAP example available.
It's possible that using Java rather than C++ might actually be easier. Java does run in lots of places and has quite nice Web Service client libraries.
Is that worth a look?