Streaming data from C++ program?
I want to stream some data from my program for other subscribers (other programs). These programs can use these data as streaming event.
What I want?
- How it is done generally?
- Any libraries o开发者_开发问答r papers pointing to technique and pros/cons?
- Security related Ideas?
I will dig more information on my own even if I get a small hint.
Example :
Program A : Object A changed =======> Program B : Report Change in Object A
Two things are generally used: sockets/pipes which are just your basic byte streams, and message passing which is a bit more complex, made for parallel use and horizontal scalability.
I am not sure if it is a bit advanced, but have a look at boost::asio http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/overview/core/basics.html
Best I found:
- Google Protobuf
- Facebook Thrift
Pros:
- Helps with establishing the formats for streaming
- Fast
- Easy to build
Cons:
- List item
- Other top-level design issues (bandwidth control, cancelation) have to go on top.
Broadly it sounds like you're trying to perform inter-process communication, aka IPC.
In the tags to your question you refer to Windows. This link provides a broad list of the IPC options within Windows.
The tag list for your question also says platform-independent. Either a socket based solution or a Pipe based solution will mostly standard across a large number of platforms that you're likely to develop for. You can either use sockets directly or use one of the numerous cross-platform wrappers, eg. ZeroMQ and Boost, to hide some of the detail.
It's not clear from the question whether Program A and Program B are running on the same machine? If not then using sockets is a better approach.
精彩评论