#include <hmbdc/app/udpcast/NetContext.hpp>
#include <hmbdc/os/Signals.hpp>
#include <boost/format.hpp>
#include <iostream>
int main(int argc, char** argv) {
if (argc != 3) {
cerr << argv[0] << " <local-ip> <multicast-group-addr:multicast-group-port>" << endl;
exit(1);
}
config.put("ifaceAddr", argv[1]);
config.put("udpcastDests", argv[2]);
auto eng = udpcast::NetContext::instance().createRecvTransportEngine(config
, [](void* packet, size_t len) {
auto buf = (uint8_t*)(packet);
size_t l = 0;
cout << "packet size=" << len;
while (l != len) {
cout << ' ' << boost::format("%02x") % (uint16_t)buf[l++];
}
cout << endl;
return -1;
}
);
cout << "waiting for packets, ctrl-c to exit" << endl;
[&ctx] {
}
);
}