#include <ACommunication.hpp>
|
| 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...
|
|
◆ ACommunication()
GameEngine::Network::ACommunication::ACommunication |
( |
asio::io_context & |
IOContext, |
|
|
unsigned short |
port |
|
) |
| |
Abstract class that will handle communication.
- Parameters
-
IOContext | that will be use to create our socket and asynchronous operation |
port | that will the socket to bind |
◆ ~ACommunication()
virtual GameEngine::Network::ACommunication::~ACommunication |
( |
| ) |
|
|
inlinevirtual |
◆ handleData()
◆ handleReceive()
handle the header information
- Parameters
-
error | if asynchronous operation failed, will be checked |
recvBytes | corresponding to the ammount of bytes receive |
header | type of data; |
◆ readHeader()
void GameEngine::Network::ACommunication::readHeader |
( |
| ) |
|
read the header to retrieve informations
◆ sendData()
template<typename Socket , typename Endpoint >
void GameEngine::Network::ACommunication::sendData |
( |
void * |
data, |
|
|
std::size_t |
size, |
|
|
uint8_t |
packetType, |
|
|
Socket & |
socket, |
|
|
Endpoint & |
endpoint |
|
) |
| |
|
inline |
Set the header to send the value.
- Template Parameters
-
Socket | Template that will be use for the socket (TCP, UDP) |
Endpoint | Template that will be use as endpoint (TCP, UDP) |
- Parameters
-
data | that will be send |
size | of the data |
packetType | that will be used to identified the header |
socket | owner socket |
endpoint | sending value to |
◆ sendInformation() [1/2]
void GameEngine::Network::ACommunication::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
- Parameters
-
data | that will be send |
size | of the data |
socket | owner of the sending message (Tcp) |
endpoint | data sending to |
header | that will determined the type of data |
◆ sendInformation() [2/2]
void GameEngine::Network::ACommunication::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
- Parameters
-
data | that will be send |
size | of the data |
socket | owner of the sending message (Udp) |
endpoint | data sending to |
header | that will determined the type of data |
◆ _buffer
asio::streambuf::mutable_buffers_type GameEngine::Network::ACommunication::_buffer |
|
protected |
◆ _endpoint
asio::ip::udp::endpoint GameEngine::Network::ACommunication::_endpoint |
|
protected |
◆ _header
◆ _listClient
std::map<unsigned short, asio::ip::udp::endpoint> GameEngine::Network::ACommunication::_listClient |
|
protected |
◆ _streamBuffer
asio::streambuf GameEngine::Network::ACommunication::_streamBuffer |
|
protected |
◆ _udpSocket
asio::ip::udp::socket GameEngine::Network::ACommunication::_udpSocket |
|
protected |
The documentation for this class was generated from the following files: