17 #include <google/protobuf/util/json_util.h> 18 #include <google/protobuf/text_format.h> 20 #include "packet.pb.h" 27 #define BUFFER_SIZE 1024U 33 int main(
int argc,
char* argv[]) {
34 const std::string listen_address_str =
"0.0.0.0";
35 const std::string multicast_address_str =
"224.0.0.1";
36 const short multicast_port = 10002;
45 for (
long int i = 0;; i++) {
49 fira_message::sim_to_ref::Environment env_data;
50 env_data.ParseFromString(data_buff);
52 std::string parsed_msg;
54 google::protobuf::util::JsonPrintOptions options;
55 options.add_whitespace =
true;
56 options.always_print_primitive_fields =
true;
58 google::protobuf::util::MessageToJsonString(env_data, &parsed_msg, options);
60 std::cout << parsed_msg << std::endl;
63 if (i % 100000 == 0) {
64 std::cout <<
"Loop count: " << i << std::endl;
67 }
catch (std::exception& e) {
68 std::cerr <<
"Exception: " << e.what() <<
"\n";
Receiver class using UDP in multicast mode.
size_t receive(char *buffer, const size_t buffer_size)
Receive data using UDP.
Receiver data using UDP in multicast mode.
int main(int argc, char *argv[])