I have a use case to send an OpenCV Mat object to multiple receivers in a multicast network. I use C++ boost library to send and receive the multicast network data.
My understanding
Mat object is serialized to a boost buffer and sent to network receivers. Receivers receive and deserialize the buffer to construct a Mat object.
Implementation I tried
My Mat object to be sent is image.
const char * px = reinterpret_cast<const char*>(image.data);
socket_.async_send_to(
boost::asio::buffer(px, sizeof(px)), endpoint_,
[this](boost::system::error_code ec, std::size_t /*length*/) {
if (!ec && message_count_ < max_message_count)
do_timeout();
});
Question 1
How to check if the complete data has reached the receiver?
Question 2
How to reconstruct the Mat object at receiver?
Question 3
Is there a better way to construct an image buffer which transfer OpenCV Mat objects in a multicast network? (I appreciate the use of boost library since it is used at multiple places)