Photon Fusion 2.0.3

Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
NetPeerGroup Struct Reference

Network Peer Group. More...

Static Public Member Functions

static NetConnectionAllocateConnection (NetPeerGroup *g, NetAddress address, byte[] token, byte[] uniqueId)
 
static void ChangeConnectionAddressDuringConnecting (NetPeerGroup *g, NetConnection *c, NetAddress newAddress)
 Changes the address of a connection during the connecting phase. More...
 
static void ChangeConnectionStatus (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetConnectionStatus status)
 
static void Connect (NetPeerGroup *g, NetAddress address, byte[] token, byte[] uniqueId=null)
 Connects to a specified address with an optional unique ID and token. More...
 
static void Connect (NetPeerGroup *g, string ip, ushort port, byte[] token, byte[] uniqueId=null)
 Connects to a specified IP address and port with an optional unique ID and token. More...
 
static NetConnectionMap.Iterator ConnectionIterator (NetPeerGroup *g)
 Gets an iterator for the connections in the network peer group. More...
 
static void Disconnect (NetPeerGroup *g, NetConnection *c, byte[] token)
 Disconnects a given connection from the network peer group with an optional token. More...
 
static NetConnectionGetConnection (NetPeerGroup *g, NetConnectionId id)
 Gets a connection by its ID in the network peer group. More...
 
static double GetConnectionBreathTime (NetPeerGroup *g, NetConnection *c)
 Get the current connection breath time More...
 
static NetConnectionGetConnectionByIndex (NetPeerGroup *g, int index)
 Gets a connection by its index in the network peer group. More...
 
static double GetConnectionIdleTime (NetPeerGroup *g, NetConnection *c)
 Gets the idle time of a connection. More...
 
static bool GetConnectionSendBuffer (NetPeerGroup *g, NetConnection *c, out NetBitBuffer *b)
 
static bool GetNotifyDataBuffer (NetPeerGroup *g, NetConnection *c, out NetBitBuffer *b)
 Gets a notify data buffer for a given connection in the network peer group. More...
 
static bool GetUnreliableDataBuffer (NetPeerGroup *g, NetConnection *c, out NetBitBuffer *b)
 Gets an unreliable data buffer for a given connection in the network peer group. More...
 
static void HandleCommandAccepted (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetCommandAccepted cmd)
 
static void HandleCommandConnect (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetCommandConnect cmd)
 
static void HandleCommandDisconnect (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetCommandDisconnect cmd)
 
static void HandleCommandRefused (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetCommandRefused cmd)
 
static void HandlePacket (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetBitBuffer *b)
 
static void HandlePacketAcks (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetNotifyHeader h)
 
static void HandlePacketCommand (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetBitBuffer *b)
 
static void HandlePacketNotifyAcks (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetBitBuffer *b)
 
static void HandlePacketNotifyData (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetBitBuffer *b)
 
static void HandlePacketNotifyData_Part2 (NetNotifyHeader header, int sequenceDistance, NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetBitBuffer *b)
 
static void HandlePacketUnconnected (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetBitBuffer *b)
 
static void HandlePacketUnreliableData (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c, NetBitBuffer *b)
 
static void QueueAddressUnmap (NetPeerGroup *g, NetConnection *c)
 
static void Receive (NetPeerGroup *g, INetPeerGroupCallbacks cb)
 
static void ReleaseConnection (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c)
 
static void Send (NetPeerGroup *g, NetConnection *c, NetBitBuffer *b)
 
static bool SendCommand< T > (NetPeerGroup *g, NetConnection *c, T cmd)
 
static void SendCommandConnect (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c)
 
static bool SendCommandUnconnected< T > (NetPeerGroup *g, NetAddress address, T cmd)
 
static bool SendNotifyDataBuffer (NetPeerGroup *g, NetConnection *c, NetBitBuffer *b, void *userData)
 Sends a notify data buffer for a given connection in the network peer group. More...
 
static void SendReliable (NetPeerGroup *g, NetConnection *c, ReliableId rid, byte *data, int dataLength)
 Sends reliable data for a given connection in the network peer group. More...
 
static void SendUnconnected (NetPeerGroup *g, NetBitBuffer *b)
 
static bool SendUnconnectedData (NetPeerGroup *g, NetAddress address, void *data, int dataLength)
 Sends unconnected data to a specified address. More...
 
static bool SendUnreliableDataBuffer (NetPeerGroup *g, NetConnection *c, NetBitBuffer *b)
 Sends an unreliable data buffer for a given connection in the network peer group. More...
 
static bool TryGetConnectionByIndex (NetPeerGroup *g, int index, out NetConnection *connection)
 Tries to get a connection by its index in the network peer group. More...
 
static void Update (NetPeerGroup *g, INetPeerGroupCallbacks cb)
 Updates the network peer group by processing received data, handling timeouts, and managing connection retries. More...
 
static void UpdateConnected (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c)
 
static void UpdateConnecting (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c)
 
static void UpdateConnections (NetPeerGroup *g, INetPeerGroupCallbacks cb)
 
static void UpdateDisconnected (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c)
 
static void UpdateShutdown (NetPeerGroup *g, INetPeerGroupCallbacks cb, NetConnection *c)
 

Public Attributes

Timer _clock
 
NetConfig _config
 
NetConnectionMap_connectionsMap
 
uint _counter
 
short _group
 
NetPeer_peer
 
IntPtr _recvHead
 
NetBitBufferStack _recvStack
 
NetBitBufferBlock * _sendBlock
 
IntPtr _sendHead
 

Static Public Attributes

const double RELIABLE_SEND_INTERVAL = 0.05
 

Properties

int ConnectionCount [get]
 Gets the number of active connections. More...
 
int Group [get]
 Gets the group index. More...
 
double Time [get]
 Gets the elapsed time in seconds. More...
 

Detailed Description

Network Peer Group.

Member Function Documentation

◆ ChangeConnectionAddressDuringConnecting()

static void ChangeConnectionAddressDuringConnecting ( NetPeerGroup g,
NetConnection c,
NetAddress  newAddress 
)
static

Changes the address of a connection during the connecting phase.

Parameters
gPointer to the network peer group.
cPointer to the connection.
newAddressThe new address to be assigned to the connection.

◆ Connect() [1/2]

static void Connect ( NetPeerGroup g,
NetAddress  address,
byte[]  token,
byte[]  uniqueId = null 
)
static

Connects to a specified address with an optional unique ID and token.

Parameters
gPointer to the network peer group.
addressThe address to connect to.
tokenThe token used for the connection.
uniqueIdOptional unique ID for the connection.

◆ Connect() [2/2]

static void Connect ( NetPeerGroup g,
string  ip,
ushort  port,
byte[]  token,
byte[]  uniqueId = null 
)
static

Connects to a specified IP address and port with an optional unique ID and token.

Parameters
gPointer to the network peer group.
ipThe IP address to connect to.
portThe port to connect to.
tokenThe token used for the connection.
uniqueIdOptional unique ID for the connection.

◆ ConnectionIterator()

static NetConnectionMap.Iterator ConnectionIterator ( NetPeerGroup g)
static

Gets an iterator for the connections in the network peer group.

Parameters
gPointer to the network peer group.
Returns
An iterator for the connections in the network peer group.

◆ Disconnect()

static void Disconnect ( NetPeerGroup g,
NetConnection c,
byte[]  token 
)
static

Disconnects a given connection from the network peer group with an optional token.

Parameters
gPointer to the network peer group.
cPointer to the connection to be disconnected.
tokenOptional token used for the disconnection.

◆ GetConnection()

static NetConnection* GetConnection ( NetPeerGroup g,
NetConnectionId  id 
)
static

Gets a connection by its ID in the network peer group.

Parameters
gPointer to the network peer group.
idThe ID of the connection to retrieve.
Returns
A pointer to the connection if found, otherwise null.

◆ GetConnectionBreathTime()

static double GetConnectionBreathTime ( NetPeerGroup g,
NetConnection c 
)
static

Get the current connection breath time

Parameters
gThe network peer group.
cThe connection whose breath time is to be calculated.
Returns
The breath time of the connection in seconds.

◆ GetConnectionByIndex()

static NetConnection* GetConnectionByIndex ( NetPeerGroup g,
int  index 
)
static

Gets a connection by its index in the network peer group.

Parameters
gPointer to the network peer group.
indexThe index of the connection to retrieve.
Returns
A pointer to the connection if found, otherwise null.

◆ GetConnectionIdleTime()

static double GetConnectionIdleTime ( NetPeerGroup g,
NetConnection c 
)
static

Gets the idle time of a connection.

Parameters
gThe network peer group.
cThe connection whose idle time is to be calculated.
Returns
The idle time of the connection in seconds.

◆ GetNotifyDataBuffer()

static bool GetNotifyDataBuffer ( NetPeerGroup g,
NetConnection c,
out NetBitBuffer b 
)
static

Gets a notify data buffer for a given connection in the network peer group.

Parameters
gPointer to the network peer group.
cPointer to the connection.
bOutput parameter that will point to the bit buffer containing the data to be sent.
Returns
True if the buffer was successfully acquired, otherwise false.

◆ GetUnreliableDataBuffer()

static bool GetUnreliableDataBuffer ( NetPeerGroup g,
NetConnection c,
out NetBitBuffer b 
)
static

Gets an unreliable data buffer for a given connection in the network peer group.

Parameters
gPointer to the network peer group.
cPointer to the connection.
bOutput parameter that will point to the bit buffer containing the data to be sent.
Returns
True if the buffer was successfully acquired, otherwise false.

◆ SendNotifyDataBuffer()

static bool SendNotifyDataBuffer ( NetPeerGroup g,
NetConnection c,
NetBitBuffer b,
void *  userData 
)
static

Sends a notify data buffer for a given connection in the network peer group.

Parameters
gPointer to the network peer group.
cPointer to the connection.
bPointer to the bit buffer containing the data to be sent.
userDataPointer to user data associated with the buffer.
Returns
True if the buffer was successfully sent, otherwise false.

◆ SendReliable()

static void SendReliable ( NetPeerGroup g,
NetConnection c,
ReliableId  rid,
byte *  data,
int  dataLength 
)
static

Sends reliable data for a given connection in the network peer group.

Parameters
gPointer to the network peer group.
cPointer to the connection.
ridReliable ID for the data being sent.
dataPointer to the data to be sent.
dataLengthThe length of the data to be sent.

◆ SendUnconnectedData()

static bool SendUnconnectedData ( NetPeerGroup g,
NetAddress  address,
void *  data,
int  dataLength 
)
static

Sends unconnected data to a specified address.

Parameters
gPointer to the network peer group.
addressThe address to send the data to.
dataPointer to the data to be sent.
dataLengthThe length of the data to be sent.
Returns
True if the data was successfully sent, otherwise false.

◆ SendUnreliableDataBuffer()

static bool SendUnreliableDataBuffer ( NetPeerGroup g,
NetConnection c,
NetBitBuffer b 
)
static

Sends an unreliable data buffer for a given connection in the network peer group.

Parameters
gPointer to the network peer group.
cPointer to the connection.
bPointer to the bit buffer containing the data to be sent.
Returns
True if the buffer was successfully sent, otherwise false.

◆ TryGetConnectionByIndex()

static bool TryGetConnectionByIndex ( NetPeerGroup g,
int  index,
out NetConnection connection 
)
static

Tries to get a connection by its index in the network peer group.

Parameters
gPointer to the network peer group.
indexThe index of the connection to retrieve.
connectionOutput parameter that will point to the connection if found.
Returns
True if the connection was found, otherwise false.

◆ Update()

static void Update ( NetPeerGroup g,
INetPeerGroupCallbacks  cb 
)
static

Updates the network peer group by processing received data, handling timeouts, and managing connection retries.

Parameters
gPointer to the network peer group.
cbCallback interface for network peer group events.

Property Documentation

◆ ConnectionCount

int ConnectionCount
get

Gets the number of active connections.

◆ Group

int Group
get

Gets the group index.

◆ Time

double Time
get

Gets the elapsed time in seconds.