NetWorker Statistics - BeardedManStudios/ForgeNetworkingRemastered GitHub Wiki

The NetWorker class contains several statistics via properties that you will probably want to query in your application.

List<NetworkingPlayer> Players

The list of all of the networked players. This is a wrapper around the native network socket with extra meta-data for each connection. Please note that you will need to use a lock to make accesses to this list thread-safe. See Thread Safe Player Iteration for more information on this topic.

Also note that this list only reflects the number of players (read: connections) that have been directly established. In other words, on a server this list will be populated with the server's own client connection and every other client that is currently connected to it. On a client, this list will only contain the connection to the server.

int MaxConnections

Maximum number of allowed connections. Should only be used in server-side code.

Note: The returned value will always be 0 for clients.

uint ServerPlayerCounter

The internal counter for a server that monotonically increases for each new client connection. It determines the connection ID of a client. Do not confuse this counter with the player count. See Players property if you want to know the number of connected players.

ulong BandwidthIn and ulong BandwidthOut

These properties contain the number of bytes that have been received and sent.