예제 #1
0
        /// <summary>
        ///     Disconnects the server and terminates all the connections with the clients.
        /// </summary>
        public static void Disconnect()
        {
            if (!IsInitialized)
            {
                return;
            }

            var clients = _clientRegistry.GetClients();

            foreach (var client in clients)
            {
                client.Disconnect();
            }

            _server.Disconnect();
            _server       = null;
            IsInitialized = false;
            Logger.Log("Server Disconnected", Color.red, "NetworkServer");
        }