Photon Fusion 2.1.1

NetPeerGroup Struct Reference

Network Peer Group. More...

Static Public Member Functions

static void ChangeConnectionAddressDuringConnecting (NetPeerGroup *g, NetConnection *c, NetAddress newAddress)
 Changes the address of a connection during the connecting phase.
static void Connect (NetPeerGroup *g, NetAddress address, byte[] token, byte[] uniqueId=null)
 Connects to a specified address with an optional unique ID and token.
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.
static NetConnectionMap.Iterator ConnectionIterator (NetPeerGroup *g)
 Gets an iterator for the connections in the network peer group.
static void Disconnect (NetPeerGroup *g, NetConnection *c, byte[] token)
 Disconnects a given connection from the network peer group with an optional token.
static double GetConnectionIdleTime (NetPeerGroup *g, NetConnection *c)
 Gets the idle time of a connection.
static bool GetNotifyDataBuffer (NetPeerGroup *g, NetConnection *c, out NetBitBuffer *b)
 Gets a notify data buffer for a given connection in the network peer group.
static bool GetUnreliableDataBuffer (NetPeerGroup *g, NetConnection *c, out NetBitBuffer *b)
 Gets an unreliable data buffer for a given connection in the network peer group.
static int Receive (NetPeerGroup *g, INetPeerGroupCallbacks cb)
 
Returns
Amount of packets received

static void RequestRejoin (NetPeerGroup *g, NetConnection *c, string sessionId)
 Request the given connect to re-join into another game Session.
static void SendReliable (NetPeerGroup *g, NetConnection *c, ReadOnlySpan< byte > data, bool progress=false)
 Sends reliable data for a given connection in the network peer group.
static void SendReliable (NetPeerGroup *g, NetConnection *c, ReadOnlySpan< byte > data1, ReadOnlySpan< byte > data2, bool progress=false)
 Sends reliable data for a given connection in the network peer group.
static bool SendUnconnectedData (NetPeerGroup *g, NetAddress address, void *data, int dataLength)
 Sends unconnected data to a specified address.
static bool SendUnreliableDataBuffer (NetPeerGroup *g, NetConnection *c, NetBitBuffer *b)
 Sends an unreliable data buffer for a given connection in the network peer group.
static bool TryGetConnectionByIndex (NetPeerGroup *g, int index, out NetConnection *connection)
 Tries to get a connection by its index in the network peer group.
static int Update (NetPeerGroup *g, INetPeerGroupCallbacks cb)
 Updates the network peer group by processing received data, handling timeouts, and managing connection retries.

Properties

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

Detailed Description

Network Peer Group.

Member Function Documentation

◆ ChangeConnectionAddressDuringConnecting()

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]

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]

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()

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()

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.

◆ GetConnectionIdleTime()

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()

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()

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.

◆ RequestRejoin()

void RequestRejoin ( NetPeerGroup * g,
NetConnection * c,
string sessionId )
static

Request the given connect to re-join into another game Session.

Parameters
gPointer to the network peer group.
cPointer to the connection to be ask for re-join.
sessionIdNew Session ID

◆ SendReliable() [1/2]

void SendReliable ( NetPeerGroup * g,
NetConnection * c,
ReadOnlySpan< byte > data,
bool progress = false )
static

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

Parameters
gPointer to the network peer group.
cPointer to the connection.
dataPointer to the data to be sent.
progress

◆ SendReliable() [2/2]

void SendReliable ( NetPeerGroup * g,
NetConnection * c,
ReadOnlySpan< byte > data1,
ReadOnlySpan< byte > data2,
bool progress = false )
static

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

Parameters
gPointer to the network peer group.
cPointer to the connection.
data1Pointer to the data to be sent.
data2Pointer to the data to be sent.
progress

◆ SendUnconnectedData()

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()

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()

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()

int 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.
Returns
Amount of received packets