42 lines
596 B
C++
42 lines
596 B
C++
#ifndef SERVER_HPP
|
|
#define SERVER_HPP
|
|
#include "asio.hpp"
|
|
#include "Core.hpp"
|
|
//#include <cstdlib>
|
|
|
|
|
|
namespace Plains {
|
|
namespace Resolver {
|
|
|
|
using Core::EventBus;
|
|
using Core::Logger;
|
|
using Core::Exception;
|
|
|
|
|
|
class Server
|
|
{
|
|
private:
|
|
EventBus& _eventBus;
|
|
Logger& _logger;
|
|
asio::io_context _ioContext;
|
|
asio::ip::udp::socket* _udpSocket;
|
|
asio::ip::udp::endpoint _sender_endpoint;
|
|
char _data[1024];
|
|
|
|
void doReceive();
|
|
void doSend(std::size_t length);
|
|
|
|
public:
|
|
Server(Logger& logger, EventBus& eventBus);
|
|
~Server();
|
|
//void run();
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
#endif
|