Symphony Of Empires
Eng3D::Networking::Server Class Referenceabstract

#include <network.hpp>

Inheritance diagram for Eng3D::Networking::Server:
Collaboration diagram for Eng3D::Networking::Server:

Classes

class  Exception
 

Public Member Functions

 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)
 
virtual void on_connect (int conn_fd, int id)=0
 
virtual void on_disconnect ()=0
 
virtual void handler (const Packet &packet, Eng3D::Deser::Archive &ar, int id)=0
 

Public Attributes

ServerClientclients
 
std::size_t n_clients
 
std::size_t player_count = 0
 

Protected Attributes

struct sockaddr_in addr
 
int fd
 
std::atomic< bool > run
 

Detailed Description

Definition at line 157 of file network.hpp.

Constructor & Destructor Documentation

◆ Server()

Server::Server ( unsigned  port,
unsigned  max_conn 
)

Definition at line 241 of file network.cpp.

Here is the call graph for this function:

◆ ~Server()

Server::~Server ( )

Definition at line 276 of file network.cpp.

Member Function Documentation

◆ broadcast()

void Server::broadcast ( const Eng3D::Networking::Packet packet)

This will broadcast the given packet to all clients currently on the server.

Definition at line 292 of file network.cpp.

Here is the caller graph for this function:

◆ do_netloop()

void Server::do_netloop ( std::function< void(int i)>  on_wake_thread,
int  id 
)

Definition at line 298 of file network.cpp.

Here is the caller graph for this function:

◆ handler()

virtual void Eng3D::Networking::Server::handler ( const Packet packet,
Eng3D::Deser::Archive ar,
int  id 
)
pure virtual

Implemented in Server.

◆ on_connect()

virtual void Eng3D::Networking::Server::on_connect ( int  conn_fd,
int  id 
)
pure virtual

Implemented in Server.

◆ on_disconnect()

virtual void Eng3D::Networking::Server::on_disconnect ( )
pure virtual

Implemented in Server.

Member Data Documentation

◆ addr

struct sockaddr_in Eng3D::Networking::Server::addr
protected

Definition at line 154 of file network.hpp.

◆ clients

ServerClient* Eng3D::Networking::Server::clients

Definition at line 185 of file network.hpp.

◆ fd

int Eng3D::Networking::Server::fd
protected

Definition at line 160 of file network.hpp.

◆ n_clients

std::size_t Eng3D::Networking::Server::n_clients

Definition at line 186 of file network.hpp.

◆ player_count

std::size_t Eng3D::Networking::Server::player_count = 0

Definition at line 187 of file network.hpp.

◆ run

std::atomic<bool> Eng3D::Networking::Server::run
protected

Definition at line 161 of file network.hpp.


The documentation for this class was generated from the following files: