22 #ifndef __M2ETIS_WRAPPER_UDP_UDPWRAPPER_H__
23 #define __M2ETIS_WRAPPER_UDP_UDPWRAPPER_H__
25 #include "boost/asio.hpp"
34 #include "boost/make_shared.hpp"
35 #include "boost/thread.hpp"
46 UdpWrapper(
const std::string & ownIP, uint16_t listenPort,
const std::string & hostIP, uint16_t hostPort);
65 throw std::runtime_error(
"UDPWrapper: not initialized. call init first!");
71 os << _name <<
":" << _listenPort;
75 node->
port_ = _listenPort;
97 std::string _hostName;
100 boost::asio::io_service _io_service;
101 boost::asio::ip::udp::socket * _socket;
104 std::vector<boost::thread *> threads_;
105 boost::array<uint8_t, 1048576> recv_buf;
107 boost::asio::io_service::strand _strand__;
109 std::deque<msgPair> _outbox;
110 boost::asio::io_service::work _work;
112 boost::asio::ip::udp::endpoint * _endpoint;
113 boost::asio::ip::udp::endpoint * _remote_endpoint;
123 void handleReceive(boost::asio::ip::udp::socket * socket, std::string message, boost::asio::ip::udp::endpoint * endpoint,
size_t len);
124 void handleReceive(
const boost::system::error_code & error,
size_t len, boost::asio::ip::udp::endpoint * re);
void send(const message::NetworkMessage< net::NetworkType< net::UDP >>::Ptr msg, net::NodeHandle< net::NetworkType< net::UDP >>::Ptr_const hint)
calls the other send method
NodeHandle in different structured p2p-systems.
net::NetworkType< net::UDP >::Key getRoot() const
returns root node
net::NodeHandle< net::NetworkType< net::UDP > >::Ptr getSelfNodeHandle() const
returns pointer with own data
void registerMessageType(const message::MessageType type, const bool ack) const
Not used right now.
creates connections using boosts UdpSocket
UdpWrapper(const std::string &ownIP, uint16_t listenPort, const std::string &hostIP, uint16_t hostPort)