English 中文(简体)
What library can I use to do simple, lightweight message passing?
原标题:

I will be starting a project which requires communication between distributed nodes(the project is in C++). I need a lightweight message passing library to pass very simple messages(basically just strings of text) between nodes. The library must have the following characteristics:

  1. No external setup required. I need to be able to get everything up-and-running in my code - I don t want to require the user to install any packages or edit any configuration files(other than a list of IP addresses and ports to connect to).

  2. The underlying protocol which the library uses must be TCP(or if it is UDP, the library must guarantee the eventual receipt of the message).

  3. The library must be able to send and receive arbitrarily large strings(think up to 3GB+).

The library needn t support any security mechanisms, fault tolerance, or encryption - I just need it to be fast, simple, and easy to use. I ve considered MPI, but concluded it would require too much setup on the user s machine for my project.

What library would you recommend for such a project? I would roll my own, but due to time constraints, I don t think that will be feasible.

最佳回答

Take a look at ØMQ, i.e. ZeroMQ.

问题回答

Apache Qpid implements server and client libraries for Advanced Message Queuing Protocol. It has many features, from which you can use the following:

  1. Client can connect anonymous on the broker, specifying broker s IP/port
  2. Transport protocol is TCP or SCTP
  3. It has support for large messages using either pull style or push style semantics
  4. It s fast
  5. Usage is simple and available in C++:

I use nanomsg for my distributed system. nanomsg is stable, mature, well supported light-weight messaging protocol library written in C.

It fulfills all your requirements:

1)  There is no external setup required
2)  TCP underlying protocol is a primary one. 
3)  Message sizes supported by nanomsg are expressed as a 64-bit integer.
 (The default message size is 1024kB. This can be easily changed by API call to 
 support any size. The maximum size is limited only by available addressable memory!)

The other good library to consider is nng. It is in betta stage now.





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签