Archived
Need help: Working sample to send stream data from server to client
Hello,
I am looking for ICE example which can demonstrate.
- An interface which defines stream data (Bytes, Image)
- Server in C++ which keep broadcasting this data to its clients
- Client in C++ to subscribe and receive this data
Pls share this, Will be very helpful
Comments
-
Hello Bhuvnesh,
We offer a number of C++ demos, but unfortunately there is not one demo that does everything you're looking for.
For stream (binary) data, you could check the interleaved and throughput demos:
https://github.com/zeroc-ice/ice-demos/tree/3.7/cpp11/Ice/interleaved
https://github.com/zeroc-ice/ice-demos/tree/3.7/cpp11/Ice/throughputBoth demos are "push" demos, where the client pushes data to the server (so one client to one server, or possibly multiple clients to one server).
If you are more interested in a server pushing/broadcasting data to its clients, then I suggest the bidir and callback demos:
https://github.com/zeroc-ice/ice-demos/tree/3.7/cpp11/Ice/callback
https://github.com/zeroc-ice/ice-demos/tree/3.7/cpp11/Ice/bidirBoth demos are similar: the server acts as a client and sends requests to clients that hosts "callback" objects. The bidir demo shows how to use bi-dir connections when your server can't open connections to your clients, typically because the clients are behind firewalls that block incoming connections.
The multicast demo could also be of interest if sending your data over udp-multicast (with no reliability guarantee) is acceptable: https://github.com/zeroc-ice/ice-demos/tree/3.7/cpp11/Ice/multicast
With this demo, the client is sending the requests over udp to the server, not the other way around.Another possible option is the DataStorm pub/sub service. Please note that DataStorm is currently in alpha testing and we don't have a set release date for the first production release. DataStorm takes care of distributing your data in a reliable and efficient manner--you don't make remote calls. See https://github.com/zeroc-ice/datastorm/tree/master/demos/cpp/minimal for a simple example.
Ice also provides its own pub/sub service, IceStorm, that decouples publishers and subscribers. With your scenario, a publisher would publish binary data to multiple subscribers through IceStorm. IceStorm is a separate service/server, not a library you link with like DataStorm, and this could complicate your deployment. See for example: https://github.com/zeroc-ice/ice-demos/tree/3.7/cpp11/IceStorm/counter
All the best,
Bernard0