public void StopServer()
 {
     listening = false;
     listener.Close();
     foreach (ClientHandle CH in CHlist)
     {
         CH.StopClient();
         CH.PacketReceived -= CH_PacketReceived;
         CH.Dispose();
     }
     foreach (Thread t in threads)
     {
         if (t.IsAlive == true)
         {
             t.Join();
         }
     }
 }