class

FGnsTransport

INetworkTransport over Valve's GameNetworkingSockets, linked standalone (no Steam client): client/server over IP for dedicated and listen servers. The library brings what ENet leaves to the engine — per-connection encryption (ephemeral key exchange, AES-GCM), pacing, message fragmentation up to 512 KB, and lanes — and the four engine channels map onto four lanes of one connection.

Module
Networking
Header
#include "Networking/GnsTransport.h"
Namespace
Mowo

Identity: without a certificate authority GNS connections are encrypted but anonymous, and each end is just its IP address. Who may join is still decided by the engine: every connection runs the same join-key exchange as an encrypted ENet link (FNetCryptoSession, net.psk or the host's join key off this machine) before either side announces the peer, and when that key is not empty payloads are additionally sealed under the keys it derived, so a party that terminates GNS's anonymous handshake on both sides still cannot read or forge them. Peer ids are the transport's own counter, as with ENet; players, rejoin tokens and platform tickets live in the session layer above.

Not covered: ICE / NAT-punched P2P (it needs a signalling service the engine does not run) and Steam's relay — Steam builds use the platform transport.

IsAvailable() is false on a platform whose library was not built; Host and Connect then fail with a log line saying so.

Constructors

SignatureNameDescription
FGnsTransport()FGnsTransport
~FGnsTransport() override~FGnsTransport
FGnsTransport(const FGnsTransport&) = deleteFGnsTransport

Public functions

ReturnsNameDescription
FGnsTransport&operator=
boolIsAvailable
boolHost
uint16_tGetBoundPort
boolConnect
voidDisconnect
voidDisconnectPeer
voidDisconnectPeerAfterFlush
voidPoll
voidSend
voidBroadcast
ConnectionStateGetState
uint32_tGetLocalPeerId
const std::vector<NetworkPeer>&GetPeers
boolGetPeerStats
std::stringGetJoinKey
voidSetJoinKey
voidSetPreSharedKeyOverrides net.psk / net.encrypt for this instance; before Host/Connect.
voidSetEncryptionMode
boolIsPeerSealedTrue once the join-key exchange with this peer passed and its payloads are sealed under the derived keys (a non-empty key on both ends).
boolIsPeerWireEncryptedWhat GNS reports about the link: encrypted on the wire (it always should be — an unencrypted connection is closed), and its end reason once closed.
int32_tGetLastEndReason

Function details

FGnsTransport

C++
FGnsTransport()

~FGnsTransport

C++
~FGnsTransport() override

FGnsTransport

C++
FGnsTransport(const FGnsTransport&) = delete

operator=

C++
FGnsTransport& operator=(const FGnsTransport&) = delete

IsAvailable

C++
static bool IsAvailable()

Host

C++
bool Host(uint16_t port, uint32_t maxClients) override

GetBoundPort

C++
uint16_t GetBoundPort() const override

Connect

C++
bool Connect(const std::string& address, uint16_t port) override

Disconnect

C++
void Disconnect() override

DisconnectPeer

C++
void DisconnectPeer(uint32_t peerId) override

DisconnectPeerAfterFlush

C++
void DisconnectPeerAfterFlush(uint32_t peerId) override

Poll

C++
void Poll(std::vector<NetworkEvent>& outEvents) override

Send

C++
void Send(uint32_t peerId, const void* data, size_t size, uint8_t channel) override

Broadcast

C++
void Broadcast(const void* data, size_t size, uint8_t channel) override

GetState

C++
ConnectionState GetState() const override

GetLocalPeerId

C++
uint32_t GetLocalPeerId() const override

GetPeers

C++
const std::vector<NetworkPeer>& GetPeers() const override

GetPeerStats

C++
bool GetPeerStats(uint32_t peerId, NetworkPeerStats& outStats) const override

GetJoinKey

C++
std::string GetJoinKey() const override

SetJoinKey

C++
void SetJoinKey(const std::string& key) override

SetPreSharedKey

C++
void SetPreSharedKey(const std::string& psk)

Overrides net.psk / net.encrypt for this instance; before Host/Connect. Off means no join key is made up, so peers from off this machine join without one — GNS still encrypts the wire.

SetEncryptionMode

C++
void SetEncryptionMode(ENetEncryptionMode mode)

IsPeerSealed

C++
bool IsPeerSealed(uint32_t peerId) const

True once the join-key exchange with this peer passed and its payloads are sealed under the derived keys (a non-empty key on both ends).

IsPeerWireEncrypted

C++
bool IsPeerWireEncrypted(uint32_t peerId) const

What GNS reports about the link: encrypted on the wire (it always should be — an unencrypted connection is closed), and its end reason once closed. For tests and the debug panel.

GetLastEndReason

C++
int32_t GetLastEndReason() const
Generated from Networking/GnsTransport.h via networking.json · Nov 4, 2026Version 1.0.0