Network manages peer-to-peer tcp connections.
More...
#include <sgct/network.h>
Network manages peer-to-peer tcp connections.
◆ ConnectionType
| Enumerator |
|---|
| SyncConnection | |
| DataTransfer | |
◆ Network()
| sgct::Network::Network |
( |
int | port, |
|
|
const std::string & | address, |
|
|
bool | isServer, |
|
|
ConnectionType | t ) |
- Parameters
-
| port | The network port (TCP) |
| address | The hostname, IPv4 address or IPv6 address |
| isServer | Indicates if this connection is a server or client |
| t | The type of connection |
◆ ~Network()
| sgct::Network::~Network |
( |
| ) |
|
◆ closeNetwork()
| void sgct::Network::closeNetwork |
( |
bool | forced | ) |
|
◆ closeSocket()
◆ id()
| int sgct::Network::id |
( |
| ) |
const |
◆ initialize()
| void sgct::Network::initialize |
( |
| ) |
|
◆ initShutdown()
| void sgct::Network::initShutdown |
( |
| ) |
|
◆ isConnected()
| bool sgct::Network::isConnected |
( |
| ) |
const |
◆ isServer()
| bool sgct::Network::isServer |
( |
| ) |
const |
◆ isUpdated()
| bool sgct::Network::isUpdated |
( |
| ) |
const |
This function compares the received frame number with the sent frame number.
The server starts by sending a frame sync number to the client. The client receives the sync frame number and sends it back after drawing when ready for buffer swap. When the server gets a frame sync number equal to the sent number it swaps buffers.
- Returns
- true if updates has been received
◆ iterateFrameCounter()
| int sgct::Network::iterateFrameCounter |
( |
| ) |
|
Iterates the send frame number and returns the new frame number.
◆ lastError()
| int sgct::Network::lastError |
( |
| ) |
|
|
static |
- Returns
- The last error code
◆ loopTime()
| double sgct::Network::loopTime |
( |
| ) |
const |
Get the time in seconds from send to receive of sync data.
◆ port()
| int sgct::Network::port |
( |
| ) |
const |
- Returns
- The port of this connection
◆ pushClientMessage()
| void sgct::Network::pushClientMessage |
( |
| ) |
|
The client sends ack message to server + console messages.
◆ recvFrameCurrent()
| int sgct::Network::recvFrameCurrent |
( |
| ) |
const |
◆ recvFramePrevious()
| int sgct::Network::recvFramePrevious |
( |
| ) |
const |
◆ sendData()
| void sgct::Network::sendData |
( |
const void * | data, |
|
|
int | length ) const |
◆ sendFrameCurrent()
| int sgct::Network::sendFrameCurrent |
( |
| ) |
const |
◆ setAcknowledgeFunction()
| void sgct::Network::setAcknowledgeFunction |
( |
std::function< void(int, int)> | fn | ) |
|
◆ setConnectedFunction()
| void sgct::Network::setConnectedFunction |
( |
std::function< void(void)> | fn | ) |
|
◆ setConnectedStatus()
| void sgct::Network::setConnectedStatus |
( |
bool | state | ) |
|
◆ setDecodeFunction()
| void sgct::Network::setDecodeFunction |
( |
std::function< void(const char *, int)> | fn | ) |
|
◆ setPackageDecodeFunction()
| void sgct::Network::setPackageDecodeFunction |
( |
std::function< void(void *, int, int, int)> | fn | ) |
|
◆ setUpdateFunction()
| void sgct::Network::setUpdateFunction |
( |
std::function< void(Network &)> | fn | ) |
|
◆ startConnectionConditionVar()
| std::condition_variable & sgct::Network::startConnectionConditionVar |
( |
| ) |
|
◆ type()
◆ Ack
| char sgct::Network::Ack = 6 |
|
staticconstexpr |
◆ ConnectedId
| char sgct::Network::ConnectedId = 18 |
|
staticconstexpr |
◆ DataId
| char sgct::Network::DataId = 17 |
|
staticconstexpr |
◆ DefaultId
| char sgct::Network::DefaultId = 0 |
|
staticconstexpr |
◆ DisconnectId
| char sgct::Network::DisconnectId = 19 |
|
staticconstexpr |
◆ HeaderSize
| size_t sgct::Network::HeaderSize = 13 |
|
staticconstexpr |
The documentation for this class was generated from the following file: