Description
The All
property provides a list of all active connections on the current server. This list includes all clients connected to the server. If the application is not running on a server, the list will contain only one connection, which is Connection.Local
. In some game scenarios, the connection list might be restricted, resulting in an empty list.
Usage
Use the All
property to access and iterate over all current connections on the server. This can be useful for server-side operations that need to interact with all connected clients, such as broadcasting messages or managing client states.
Example
// Example: Iterating over all connections and printing their names
foreach (var connection in Connection.All)
{
string connectionName = connection.Name;
// Perform operations with each connection
// For example, logging the connection name
// Log(connectionName);
}