private void Form1_Load(object sender, EventArgs e) { // Hide(); // ShowIcon = false; // ShowInTaskbar = false; // FormBorderStyle = FormBorderStyle.None; StopWatch.Start(); Console.Title = "TheArcaneChat Server -=- v1.0.0"; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; Console.Clear(); ServerSocket.Start(); Log(" >> Server Started"); //Visible = false; new Thread(() => { //serverSocket.Server.Listen(1000); while (true) { try { while (!ServerSocket.Pending()) { Thread.Sleep(5); } ClientSocket = ServerSocket.AcceptTcpClient(); //Log($" >> Client No: {_counter++} started!"); Clients.Add(ClientSocket); new HandleClient(this).StartClient(ClientSocket, _counter); _counter++; new Task(() => { new SoundPlayer(@"C:\Windows\Media\Speech On.wav").Play(); }).Start(); this.Invoke(new MethodInvoker(() => { ConnectionCount.Text = $"Connected clients: {Clients.Count}"; })); } catch (Exception exception) { //Log(exception); } } }).Start(); }