class
#include <Jazz2/Multiplayer/NetworkManager.h>
NetworkManager Allows to create network clients and servers.
Public static variables
-
static std::
size_t MaxPeerCount constexpr
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.
-
auto CreateServer(INetworkHandler* handler,
std::
uint16_t port) -> bool - Creates a server.
- void Dispose()
- Disposes all active connections.
- auto GetState() const -> NetworkState
- Returns state of network connection.
-
void SendToPeer(const Peer& peer,
NetworkChannel channel,
const std::
uint8_t* data, std:: size_t dataLength) - Sends a packet to a given peer.
- void SendToPeer(const Peer& peer, NetworkChannel channel, const MemoryStream& packet)
-
void SendToAll(NetworkChannel channel,
const std::
uint8_t* data, std:: size_t dataLength) - Sends a packet to all connected peers.
- void SendToAll(NetworkChannel channel, const MemoryStream& packet)
- void KickClient(const Peer& peer, Reason reason)
- Kicks a given peer from the server.
Function documentation
void Jazz2:: Multiplayer:: NetworkManager:: SendToPeer(const Peer& peer,
NetworkChannel channel,
const MemoryStream& packet)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Jazz2:: Multiplayer:: NetworkManager:: SendToAll(NetworkChannel channel,
const MemoryStream& packet)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.