Manages network communication for the server with dedicated thread.
~ServerNetworkManager()
Destructor - stops network thread.
std::jthread _networkThread
bool isRunning() const
Check if server is running.
void setPacketHandler(PacketHandler handler)
Set packet handler callback.
ThreadSafeQueue< HostNetworkEvent > _eventQueue
void processMessages()
Process incoming network events from the queue.
std::unique_ptr< IHost > _host
void stop()
Stop the server and network thread.
bool start()
Start the server and network thread.
PacketHandler _packetHandler
void networkThreadLoop(std::stop_token stopToken)
Network thread main loop.
std::function< void(HostNetworkEvent &)> PacketHandler
Packet handler callback type.
Thread-safe queue for inter-thread communication.
Represents a network event (connection, disconnection, or received data).