This commit is contained in:
subtly 2014-12-18 20:25:36 +01:00
parent b3b4411c4c
commit ed9a5e572a

15
net.cpp
View File

@ -28,6 +28,21 @@ using namespace dev::p2p;
namespace ba = boost::asio; namespace ba = boost::asio;
namespace bi = ba::ip; namespace bi = ba::ip;
class Kademlia: UDPSocketEvents
{
public:
Kademlia(): Worker("test",0), m_io(), m_socket(new UDPSocket<Kademlia, 1024>(m_io, *this, 30300)) {}
~Kademlia() { m_io.stop(); stopWorking(); }
void onDisconnected(UDPSocketFace*) {};
void onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytesConstRef _packet) { if (_packet.toString() == "AAAA") success = true; }
ba::io_service m_io;
shared_ptr<UDPSocket<Kademlia, 1024>> m_socket;
bool success = false;
};
class TestA: UDPSocketEvents, public Worker class TestA: UDPSocketEvents, public Worker
{ {
public: public: