CUGL 2.5
Cornell University Game Library
|
#include <CUNetcodeChannel.h>
Public Member Functions | |
NetcodeChannel () | |
~NetcodeChannel () | |
const std::string | getLabel () const |
const std::shared_ptr< NetcodePeer > | getPeer () |
const std::shared_ptr< NetcodeConnection > | getConnection () |
bool | close () |
bool | send (const std::vector< std::byte > &data) |
void | setDebug (bool flag) |
bool | getDebug () const |
Friends | |
class | NetcodePeer |
class | NetcodeConnection |
This class represents a single data channel
Netcode communicates between devices on the network using data channels. A data channel is reliable, high speed communication that happens directly, and does not take place through the lobby server. A data channel is a relationship between two devices, providing bi-directional communication. It is possible for two devices to have more than one data channel between them, such as conversations marked private or public.
Users should not create data channels directly, and as such all constructors and allocators for this class are private. All data channels are associated with a NetcodePeer
and should be constructed from them. We have only exposed this class to simplify development.
cugl::net::NetcodeChannel::NetcodeChannel | ( | ) |
Creates a degenerate RTC data channel.
This object has not been initialized by a NetcodePeer
and cannot be used.
You should NEVER USE THIS CONSTRUCTOR. All data channels should be created by a NetcodeConnection
instead.
cugl::net::NetcodeChannel::~NetcodeChannel | ( | ) |
Deletes this RTC data channel, disposing all resources
bool cugl::net::NetcodeChannel::close | ( | ) |
Closes this data channel
The data channel will automatically be removed from its parent.
const std::shared_ptr< NetcodeConnection > cugl::net::NetcodeChannel::getConnection | ( | ) |
Returns the NetcodeConnection
associated with this data channel
Most users should never need to access this method. It is provided for debugging purposes only.
This method is not const because it requires a lock.
NetcodeConnection
associated with this data channel
|
inline |
Returns the debugging status of this channel.
If debugging is active, connections will be quite verbose
|
inline |
Returns the label for this data channel.
Each peer-to-peer pair has exactly one data channel with this label.
const std::shared_ptr< NetcodePeer > cugl::net::NetcodeChannel::getPeer | ( | ) |
Returns the parent NetcodePeer
of this data channel
Most users should never need to access this method. All communication should take place using the associated NetcodeConnection
. It is provided for debugging purposes only.
This method is not const because it requires a lock.
NetcodePeer
of this data channel bool cugl::net::NetcodeChannel::send | ( | const std::vector< std::byte > & | data | ) |
Sends data along this data channel to its recipient
Most users should never need to access this method. All communication should take place using the associated NetcodeConnection
. It is provided for debugging purposes only.
data | The data to send |
|
inline |
Toggles the debugging status of this channel.
If debugging is active, connections will be quite verbose
flag | Whether to activate debugging |
|
friend |
Allow access to the other netcode classes