FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::net::ServerSideNetUdp Class Reference

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
ServerSideNetUdpoperator= (ServerSideNetUdp const &r)=delete
ServerSideNetUdpoperator= (ServerSideNetUdp &&r) noexcept=delete
void setVersioningString (std::string_view versioningString)
std::string const & getVersioningString () const
bool start (Port bindPort, IpAddress const &bindIp, IpAddress::Types addressType=IpAddress::Types::None)
bool start (IpAddress::Types addressType=IpAddress::Types::None)
void stop ()
ServerNetFluxUdpnewFlux ()
 Create a new flux.
ServerNetFluxUdpgetFlux (std::size_t index)
ServerNetFluxUdpgetDefaultFlux ()
std::size_t getFluxSize () const
IpAddress::Types getAddressType () const
void closeFlux (NetFluxUdp *flux)
void closeAllFlux ()
void repushPacket (ReceivedPacketPtr &&packet)
void notifyTransmission ()
 Notify the transmission thread.
bool isRunning () const
void notifyNewClient (Identity const &identity, ClientSharedPtr const &client)
void sendTo (TransmitPacketPtr &pck, Client const &client, Identity const &id)
void sendTo (TransmitPacketPtr &pck, Identity const &id)
void * getCryptContext () const

Detailed Description

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.

Member Function Documentation

◆ newFlux()

ServerNetFluxUdp * fge::net::ServerSideNetUdp::newFlux ( )
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.

See also
NetFluxUdp
Returns
A pointer to the new flux

◆ notifyTransmission()

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.


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