private void ServerCloseButton_Click(object sender, EventArgs e) { for (int i = 0; i < Chat_Thread.Length; i++) { if (Chat_Thread[i] != null) { Chat_Thread[i].Abort(); } if (Client[i] != null && Client[i].Connected) { Client[i].Close(); } } Server.Close(); Server = null; ImageServer.Close(); ImageServer = null; ServerOpenThread.Abort(); ReceiveImageThread.Abort(); ServerOpenButton.Enabled = true; ServerCloseButton.Enabled = false; }