R-Type
|
UdpServer Class that create a UDP server that client can connect to communicate. More...
#include <UdpServer.hpp>
Public Member Functions | |
UdpServer (asio::io_context &IOContext, unsigned short port, SafeQueue< struct RType::Event > &eventQueue) | |
~UdpServer () | |
void | handleData (struct RType::Protocol::HeaderDataPacket &header, unsigned short port) |
Handle the data depends of the header. More... | |
void | sendInformation (uint8_t packetType, std::vector< std::byte > dataToSend, asio::ip::udp::endpoint &endpoint) |
Function that will send informations to connected clients. More... | |
void | handleString (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
Handle String that will be retrieve and push a event. More... | |
void | handleConnexion (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
Handle Connexion that will be retrieve and push a event. More... | |
void | handleDisconnexion (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
Handle Disconnexion that will be retrieve and push a event. More... | |
void | run () |
Start the UDP Server. More... | |
void | handleTextureResponse (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleCollisionResponse (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
void | handleInput (struct RType::Protocol::HeaderDataPacket header, unsigned short port) |
std::map< unsigned short, asio::ip::udp::endpoint > & | getListClients () |
![]() | |
ACommunication (asio::io_context &IOContext, unsigned short port) | |
Abstract class that will handle communication. More... | |
virtual | ~ACommunication () |
template<typename Socket , typename Endpoint > | |
void | sendData (void *data, std::size_t size, uint8_t packetType, Socket &socket, Endpoint &endpoint) |
Set the header to send the value. More... | |
void | sendInformation (void *data, std::size_t size, asio::ip::udp::socket &socket, asio::ip::udp::endpoint &endpoint, struct RType::Protocol::HeaderDataPacket &header) |
send the data to endpoint from the socket More... | |
void | sendInformation (void *data, std::size_t size, asio::ip::tcp::socket &socket, asio::ip::tcp::endpoint &, struct RType::Protocol::HeaderDataPacket &header) |
send the data to endpoint from the socket More... | |
void | handleReceive (const asio::error_code &error, std::size_t recvBytes, struct RType::Protocol::HeaderDataPacket &header) |
handle the header information More... | |
void | readHeader () |
read the header to retrieve informations More... | |
Additional Inherited Members | |
![]() | |
asio::streambuf | _streamBuffer |
asio::ip::udp::socket | _udpSocket |
asio::streambuf::mutable_buffers_type | _buffer |
struct RType::Protocol::HeaderDataPacket | _header |
asio::ip::udp::endpoint | _endpoint |
std::map< unsigned short, asio::ip::udp::endpoint > | _listClient |
UdpServer Class that create a UDP server that client can connect to communicate.
RType::Server::UdpServer::UdpServer | ( | asio::io_context & | IOContext, |
unsigned short | port, | ||
SafeQueue< struct RType::Event > & | eventQueue | ||
) |
RType::Server::UdpServer::~UdpServer | ( | ) |
std::map< unsigned short, asio::ip::udp::endpoint > & RType::Server::UdpServer::getListClients | ( | ) |
void RType::Server::UdpServer::handleCollisionResponse | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Server::UdpServer::handleConnexion | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
Handle Connexion that will be retrieve and push a event.
header | that contains the size of the payload |
|
virtual |
Handle the data depends of the header.
error | if asynchronous operation fails, it will be checked |
header | that contain the type of data |
Implements GameEngine::Network::ACommunication.
void RType::Server::UdpServer::handleDisconnexion | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
Handle Disconnexion that will be retrieve and push a event.
header | that contains the size of the payload |
void RType::Server::UdpServer::handleInput | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Server::UdpServer::handleString | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
Handle String that will be retrieve and push a event.
header | that contains the size of the payload |
void RType::Server::UdpServer::handleTextureResponse | ( | struct RType::Protocol::HeaderDataPacket | header, |
unsigned short | port | ||
) |
void RType::Server::UdpServer::run | ( | ) |
Start the UDP Server.
void RType::Server::UdpServer::sendInformation | ( | uint8_t | packetType, |
std::vector< std::byte > | dataToSend, | ||
asio::ip::udp::endpoint & | endpoint | ||
) |
Function that will send informations to connected clients.
packetType | the type of data that will be send |
dataToSend | that will be send to clients |