예제 #1
0
        // -------------------------------------------------------------------------------------------------------------------------
        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());
                }
            }
        }
예제 #2
0
 // -------------------------------------------------------------------------------------------------------------------------
 // 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();
 }
예제 #3
0
 // -------------------------------------------------------------------------------------------------------------------------
 // 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();
 }