public void StartKeepAliveThread() { Thread keepAliveThread = new Thread((threadStart3) => { while (Server.Running) { // Get a Now time for this cycle int now = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; // Loop through the clients for (int i = 0; i < Clients.Count; i++) { // Client SOEClient client = GetClient(i); // Empty space? if (client == null) { continue; } // Idle? if (now > (client.GetLastInteraction() + Server.CLIENT_TIMEOUT)) { Log("Disconnecting Idle client."); client.Disconnect((ushort)SOEDisconnectReasons.Timeout); } } Thread.Sleep(Server.SERVER_THREAD_SLEEP); } }); keepAliveThread.Name = "SOEServer::KeepAliveThread"; keepAliveThread.Start(); }