reckfellENGINE

ENetMultiplayerPeer

An ENet/UDP multiplayer transport.

On this page
class ENetMultiplayerPeerReckfellSharpInherits MultiplayerPeer

Creates ENet server/client connections for MultiplayerApi. CreateClient begins connecting; API state/signals determine completion. The server peer has ID 1; client IDs are temporary and do not replace accounts.

Choose transfer mode/channels for the data. Reliable is not durable result confirmation after disconnection. ENet does not automatically add authentication, encryption, NAT traversal or server gameplay rules.

Practical guide.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

ENetMultiplayerPeerConstructor
# ENetMultiplayerPeer
C#
public ENetMultiplayerPeer();

Properties1

HostProperty
# Host
C#
public ENetConnection Host { get; }

The underlying ENetConnection created after ENetMultiplayerPeer.CreateClient and ENetMultiplayerPeer.CreateServer.

Methods7

AddMeshPeerError
# AddMeshPeer
C#
public Error AddMeshPeer(int peerId, ENetConnection host);

Add a new remote peer with the given peer_id connected to the given ENetMultiplayerPeer.Host. Note: The ENetMultiplayerPeer.Host must have exactly one peer in the ENetPacketPeer.PeerState.Connected state.

Parameters
NameTypeDefault
peerIdint—
hostENetConnection—
Returns Error
CreateClientError
# CreateClient
C#
public Error CreateClient(string address, int port, int channelCount = 0, int inBandwidth = 0, int outBandwidth = 0, int localPort = 0);

Begins an ENet connection. Error.Ok does not mean ConnectedToServer. Coordinate user-channel counts and handle failure/disconnection.

Parameters
NameTypeDefault
addressstring—
portint—
channelCountint0
inBandwidthint0
outBandwidthint0
localPortint0
Returns Error
CreateMeshError
# CreateMesh
C#
public Error CreateMesh(int uniqueId);

Initialize this MultiplayerPeer in mesh mode. The provided unique_id will be used as the local peer network unique ID once assigned as the MultiplayerApi.MultiplayerPeer. In the mesh configuration you will need to set up each new peer manually using ENetConnection before calling ENetMultiplayerPeer.AddMeshPeer. While this technique is more advanced, it allows for better control over the connection process (e.g. when dealing with NAT punch-through) and for better distribution of the network load (which would otherwise be more taxing on the server).

Parameters
NameTypeDefault
uniqueIdint—
Returns Error
CreateServerError
# CreateServer
C#
public Error CreateServer(int port, int maxClients = 32, int maxChannels = 0, int inBandwidth = 0, int outBandwidth = 0);

Creates an ENet server on a UDP port. Configure bind IP first. Port 0 lets the OS choose a free port; a client limit is not authentication.

Parameters
NameTypeDefault
portint—
maxClientsint32
maxChannelsint0
inBandwidthint0
outBandwidthint0
Returns Error
GetHostENetConnection
# GetHost
C#
public ENetConnection GetHost();
Returns ENetConnection
GetPeerENetPacketPeer
# GetPeer
C#
public ENetPacketPeer GetPeer(int id);

Returns the ENetPacketPeer associated to the given id.

Parameters
NameTypeDefault
idint—
Returns ENetPacketPeer
SetBindIPvoid
# SetBindIP
C#
public void SetBindIP(string iP);

Sets the local bind address before creating a connection. 127.0.0.1 is reachable only on the same machine; deployment requires separate interface/routing choices.

Parameters
NameTypeDefault
iPstring—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.