Symphony Of Empires
|
#include <server_network.hpp>
Classes | |
struct | ClientData |
Public Member Functions | |
Server (GameState &gs, unsigned port=1825, unsigned max_conn=4) | |
~Server ()=default | |
void | netloop (int id) |
This is the handling thread-function for handling a connection to a single client Sending packets will only be received by the other end, when trying to broadcast please put the packets on the send queue, they will be sent accordingly. More... | |
void | on_connect (int conn_fd, int id) override |
void | on_disconnect () override |
void | handler (const Eng3D::Networking::Packet &packet, Eng3D::Deser::Archive &ar, int id) override |
Public Member Functions inherited from Eng3D::Networking::Server | |
Server (unsigned port, unsigned max_conn) | |
~Server () | |
void | broadcast (const Eng3D::Networking::Packet &packet) |
This will broadcast the given packet to all clients currently on the server. More... | |
void | do_netloop (std::function< void(int i)> on_wake_thread, int id) |
Public Attributes | |
std::vector< ClientData > | clients_data |
std::vector< Nation * > | clients_extra_data |
std::unordered_map< ActionType, std::function< void(ClientData &client_data, const Eng3D::Networking::Packet &packet, Eng3D::Deser::Archive &ar)> > | action_handlers |
Public Attributes inherited from Eng3D::Networking::Server | |
ServerClient * | clients |
std::size_t | n_clients |
std::size_t | player_count = 0 |
Additional Inherited Members | |
Protected Attributes inherited from Eng3D::Networking::Server | |
struct sockaddr_in | addr |
int | fd |
std::atomic< bool > | run |
Definition at line 49 of file server_network.hpp.
Server::Server | ( | GameState & | gs, |
unsigned | port = 1825 , |
||
unsigned | max_conn = 4 |
||
) |
Definition at line 40 of file server_network.cpp.
|
default |
|
overridevirtual |
Implements Eng3D::Networking::Server.
Definition at line 272 of file server_network.cpp.
void Server::netloop | ( | int | id | ) |
This is the handling thread-function for handling a connection to a single client Sending packets will only be received by the other end, when trying to broadcast please put the packets on the send queue, they will be sent accordingly.
Definition at line 293 of file server_network.cpp.
|
overridevirtual |
Implements Eng3D::Networking::Server.
Definition at line 230 of file server_network.cpp.
|
overridevirtual |
Implements Eng3D::Networking::Server.
Definition at line 264 of file server_network.cpp.
std::unordered_map<ActionType, std::function<void(ClientData& client_data, const Eng3D::Networking::Packet& packet, Eng3D::Deser::Archive& ar)> > Server::action_handlers |
Definition at line 72 of file server_network.hpp.
std::vector<ClientData> Server::clients_data |
Definition at line 70 of file server_network.hpp.
std::vector<Nation*> Server::clients_extra_data |
Definition at line 71 of file server_network.hpp.