Thunderbots Project
Loading...
Searching...
No Matches
udp_sender.h
1#pragma once
2
3#include <boost/asio.hpp>
4#include <boost/bind.hpp>
5#include <string>
6
8{
9 public:
25 UdpSender(boost::asio::io_service& io_service, const std::string& ip_address,
26 unsigned short port, const std::string& interface, bool multicast);
27
31 ~UdpSender();
32
38 std::string getInterface() const;
39
45 std::string getIpAddress() const;
46
59 void sendString(const std::string& message);
60
67 void sendStringAsync(const std::string& message);
68
69 private:
78 void setupMulticast(const boost::asio::ip::address& ip_address,
79 const std::string& interface);
80
81 // A UDP socket to send data over
82 boost::asio::ip::udp::socket socket_;
83
84 // The endpoint for the receiver
85 boost::asio::ip::udp::endpoint receiver_endpoint;
86
87 // The interface to send data on
88 std::string interface_;
89
90 // The IP address to send data to (IPv4 in dotted decimal or IPv6 in hex string)
91 std::string ip_address_;
92};
Definition udp_sender.h:8
std::string getIpAddress() const
Definition udp_sender.cpp:33
void sendStringAsync(const std::string &message)
Definition udp_sender.cpp:43
void sendString(const std::string &message)
Definition udp_sender.cpp:38
~UdpSender()
Definition udp_sender.cpp:79
std::string getInterface() const
Definition udp_sender.cpp:28