class
#include <Jazz2/Multiplayer/NetworkManager.h>
NetworkManager Allows to create network clients and servers.
Public static variables
-
static std::
size_t MaxPeerCount constexpr - Maximum connected peer count.
Constructors, destructors, conversion operators
- NetworkManager()
- ~NetworkManager()
- NetworkManager(const NetworkManager&) deleted
Public functions
- auto operator=(const NetworkManager&) -> NetworkManager& deleted
-
auto CreateClient(INetworkHandler* handler,
StringView address,
std::
uint16_t port, std:: uint32_t clientData) -> bool - Creates a client connection to a remote server.
-
auto CreateServer(INetworkHandler* handler,
std::
uint16_t port) -> bool - Creates a server accepting that accepts incoming connections.
- void Dispose()
- Disposes all active connections.
- auto GetState() const -> NetworkState
- Returns state of network connection.
-
void SendTo(const Peer& peer,
NetworkChannel channel,
std::
uint8_t packetType, ArrayView<const std:: uint8_t> data) - Sends a packet to a given peer.
-
void SendTo(Function<bool(const Peer&)>&& predicate,
NetworkChannel channel,
std::
uint8_t packetType, ArrayView<const std:: uint8_t> data) - Sends a packet to all connected peers that match a given predicate.
-
void SendTo(AllPeersT,
NetworkChannel channel,
std::
uint8_t packetType, ArrayView<const std:: uint8_t> data) - Sends a packet to all connected peers or the remote server peer.
- void Kick(const Peer& peer, Reason reason)
- Kicks a given peer from the server.