Client

The Client class store all networking information about a client

Public member functions

//Construct a new client
Client(asio::ip::udp::socket &socket, asio::ip::udp::endpoint endpoint);
//Destruct a client
~Client();
Client(const Client &client) = delete;
Client(Client &&client) = delete;
Client &operator=(const Client &client) = delete;
Client &operator=(Client &&client) = delete;
//get the client endpoint
const asio::ip::udp::endpoint &getEndpoint() const;
//get all the incomming client data before being packaged
Stream &getStreamIn();
//return an instruction and a stream if a package is avaible in _streamIn
std::pair<size_t, Stream> getNextInst();
//get the out binary buffer in preparation
Stream &getStreamOut();
//set an instruction before sending
void setInst(unsigned char inst);
//send a Stream to this client
void send(const Stream &message);
//send the Stream _streamOut with the _instOut
void send();
//check last time client exchange with the server
bool isAlive();
//update the client activity
void ping();

Private attributes

Member functions documentation

Constructor

Parameters

  • socket the server socket

  • endpoint the client endpoint

getEndpoint

return the client endpoint

getStreamIn

return the incomming stream

getNextInst

Try to get an instruction from th _streamIn. If it can, it return the instruction and the stream of request.

getStreamOut

return the _outStream attribute

setInst

Set the _instOut attribute

send

send the Stream in parameter to the client

send

send the _streamOut stream with the _instOut instruction

isAlive

check the time since the last client activity

ping

refresh th client activity

Last updated