![]() |
FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
|
A server side network manager. More...
#include <C_server.hpp>
Public Member Functions | |
ServerSideNetUdp (IpAddress::Types addressType=IpAddress::Types::Ipv4) | |
ServerSideNetUdp (ServerSideNetUdp const &r)=delete | |
ServerSideNetUdp (ServerSideNetUdp &&r) noexcept=delete | |
ServerSideNetUdp & | operator= (ServerSideNetUdp const &r)=delete |
ServerSideNetUdp & | operator= (ServerSideNetUdp &&r) noexcept=delete |
template<class TPacket = Packet> | |
bool | start (Port bindPort, IpAddress const &bindIp, IpAddress::Types addressType=IpAddress::Types::None) |
template<class TPacket = Packet> | |
bool | start (IpAddress::Types addressType=IpAddress::Types::None) |
void | stop () |
ServerNetFluxUdp * | newFlux () |
Create a new flux. | |
ServerNetFluxUdp * | getFlux (std::size_t index) |
ServerNetFluxUdp * | getDefaultFlux () |
std::size_t | getFluxSize () const |
IpAddress::Types | getAddressType () const |
void | closeFlux (NetFluxUdp *flux) |
void | closeAllFlux () |
void | repushPacket (FluxPacketPtr &&fluxPck) |
void | notifyTransmission () |
Notify the transmission thread. | |
bool | isRunning () const |
void | sendTo (TransmissionPacketPtr &pck, Client const &client, Identity const &id) |
void | sendTo (TransmissionPacketPtr &pck, Identity const &id) |
A server side network manager.
This class is used to manage clients on the server side. When started, it will create two threads, one for the reception and one for the transmission.
The reception thread will receive packets from the network and push them in created fluxes.
The transmission thread will pop packets from the client queued packets and send them taking care of the latency.
|
nodiscard |
Create a new flux.
When receiving a packet, the server will push it into a flux sequentially, if the thread that handle the flux doesn't want to handle the packet (because the packet is not from his client list, or other reasons) the thread must call repushPacket() to push the packet into another flux.
If no flux is available, the packet is pushed into the default flux or dismissed if the default flux is full.
void fge::net::ServerSideNetUdp::notifyTransmission | ( | ) |
Notify the transmission thread.
This function notify the transmission thread to send packets. This should be called when a packet when you finish to push packets for clients.