#include "aare.hpp" #include "aare/examples/defs.hpp" #include // std::time #include #include // sleep #include #include using namespace aare; int main() { std::srand(std::time(nullptr)); std::string const endpoint = "tcp://*:5555"; aare::ZmqSocketSender socket(endpoint); socket.bind(); Frame frame(1024, 1024, Dtype::UINT32); for (int i = 0; i < 1024; i++) { for (int j = 0; j < 1024; j++) { frame.set(i, j, i + j); } } aare::ZmqHeader header; header.shape = {1024, 1024}; header.size = sizeof(uint32_t) * 1024 * 1024; header.bitmode = 32; std::vector zmq_frames; // send two exact frames std::chrono::milliseconds sleep_time(1); // or whatever int acqid = 0; while (true) { zmq_frames.clear(); header.acqIndex = acqid++; size_t const n_frames = std::rand() % 10 + 1; aare::logger::info("acquisition:", header.acqIndex); aare::logger::info("Header size:", header.to_string().size()); aare::logger::info("Frame size:", frame.bytes()); aare::logger::info("Number of frames:", n_frames); for (size_t i = 0; i < n_frames; i++) { zmq_frames.push_back({header, frame}); } size_t const rc = socket.send(zmq_frames); aare::logger::info("Sent bytes", rc); std::this_thread::sleep_for(sleep_time); } return 0; }