# MultiStreamHandler Example

**URL:** <https://forum.commonvisionblox.com/t/multistreamhandler-example/696>\
**Category:** C++ API\
**Tags:** acquisition, genicam\
**Created:** [March 1, 2019, 11:03am UTC](https://forum.commonvisionblox.com/t/multistreamhandler-example/696 "2019-03-01T11:03:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theo](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/theo/32/482_2.png) [@Theo](https://forum.commonvisionblox.com/u/Theo)\
**Post date:** [March 1, 2019, 11:03am UTC](https://forum.commonvisionblox.com/t/multistreamhandler-example/696/1 "2019-03-01T11:03:57Z")

</div>

Hi,

I have recently worked on a small console example where I could use the CVB MultiStreamHandler as I acquired images from four synchronized cameras. The MultiStreamHandler can not be used with non synchronized cameras.  
As I think this example might be helpfull the forum seems to be good place to share it.

The example is written with the CVB++ wrapper and is ment for CoaxPress cameras. It also has included the nodemap handling necessary to setup the cameras.

> **Code snipped (complete example attached)**
>
> ```cpp
>  
> class MyMultiStreamHandler
> :public Cvb::MultiStreamHandler
> {
> 
>     
> public: 
> MyMultiStreamHandler(const std::vector<Cvb::StreamPtr> & streamVector)
> :MultiStreamHandler(streamVector)
> {
> 
> }
> 
> private: 
> void HandleAsyncStream(const std::vector<Cvb::StreamPtr> &streamVector) override
> {
> auto readData = 0;
> for (auto & stream : streamVector)
> {
> auto result = stream->WaitFor<Cvb::RingBufferImage>(std::chrono::milliseconds(500));
> 
> // Do something.
> 
> }
> }
> 
> };
> 
> ```

Thanks @Andreas for all the help.

Theo

[CppMultiStreamHandler.zip](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/cbf29f8f188dab127128731e96854431c7ffe476.zip) (2.2 KB)
