|
R-Type
Distributed multiplayer game engine in C++
|
Interface representing a network host (server or client endpoint). More...
#include <IHost.hpp>


Public Member Functions | |
| virtual | ~IHost ()=default |
| virtual IPeer * | connect (const IAddress &address, size_t channelCount=1, uint32_t data=0)=0 |
| Connect to a remote host. | |
| virtual std::optional< HostNetworkEvent > | service (uint32_t timeout=0)=0 |
| Service the host, processing network events. | |
| virtual void | broadcast (std::unique_ptr< IPacket > packet, uint8_t channelID=0)=0 |
| Broadcast a packet to all connected peers. | |
| virtual void | flush ()=0 |
| Send all queued packets immediately. | |
| virtual size_t | getPeerCount () const =0 |
| Get the number of connected peers. | |
| virtual const IAddress & | getAddress () const =0 |
| Get the address this host is bound to. | |
Interface representing a network host (server or client endpoint).
IHost manages connections and network communication. It can act as a server accepting connections or as a client connecting to a server. The concrete implementation (ENetHost, custom socket manager, etc.) is hidden behind this interface to allow backend swapping.
|
virtualdefault |
|
pure virtual |
Broadcast a packet to all connected peers.
| packet | The packet to broadcast. |
| channelID | The channel to broadcast on. |
Implemented in ENetHostWrapper.
|
pure virtual |
Connect to a remote host.
| address | The address to connect to. |
| channelCount | Number of channels to allocate (default: 1). |
| data | User data to send with the connection request. |
Implemented in ENetHostWrapper.
|
pure virtual |
Send all queued packets immediately.
Implemented in ENetHostWrapper.
|
pure virtual |
Get the address this host is bound to.
Implemented in ENetHostWrapper.
|
pure virtual |
Get the number of connected peers.
Implemented in ENetHostWrapper.
|
pure virtual |
Service the host, processing network events.
| timeout | Maximum time to wait for events in milliseconds. |
Implemented in ENetHostWrapper.