// ------------------------------------------------------------------------------------------------------------------------- public static void listActiveConnections() { int numConnections = serverHandler.getConnectedClientCount(); if (numConnections == 0) { logger.Info("Network: No clients connected!"); } else { for (int i = 0; i != numConnections; i++) { ServerHandler.SocketDescriptor desc = serverHandler.getSocketDescriptor(i); logger.Info("Network: Connection " + (i + 1).ToString() + " client: " + desc.state.remoteEndpoint + ", type: " + desc.clientType.ToString()); } } }
// ------------------------------------------------------------------------------------------------------------------------- // callback function that gets notified whenever a disconnection has been received private static void _serverReceivedDisconnection(INetworkServer server, Socket client) { ServerHandler.SocketDescriptor s = serverHandler.getSocketDescriptor(client); logger.Info("Network: Received disconnection from client "); listActiveConnections(); }
// ------------------------------------------------------------------------------------------------------------------------- // callback function that gets notified whenever a new connection has been received private static void _serverReceivedConnection(INetworkServer server, Socket client) { ServerHandler.SocketDescriptor s = serverHandler.getSocketDescriptor(client); logger.Info("Network: Received connection from:" + s.state.remoteEndpoint); listActiveConnections(); }