private void DisConnectButton_Click(object sender, EventArgs e) { GetData_From_Client.Abort(); SendImage_To_Server_Thread.Abort(); Client.Disconnect(false); Client.Shutdown(SocketShutdown.Both); Client.Close(); ImageClient.Disconnect(false); ImageClient.Shutdown(SocketShutdown.Both); ImageClient.Close(); SendButton.Enabled = false; DisConnectButton.Enabled = false; ConnectButton.Enabled = true; SendImageButton.Enabled = false; }
private void CloseAll(object sender, FormClosingEventArgs e) { try { if (Client[0].Connected) { Client[0].Close(); } if (InputClient.Connected) { InputClient.Close(); } if (ImageClient.Connected) { ImageClient.Close(); } ServerOpenThread.Abort(); ReceiveImageThread.Abort(); } catch (Exception E) { } }
private void CloseAll(object sender, FormClosingEventArgs e) { try { if (Client.Connected) { Client.Close(); } if (ImageClient.Connected) { ImageClient.Close(); } if (InputClient.Connected) { InputClient.Close(); } GetData_From_Client.Abort(); SendImage_To_Server_Thread.Abort(); GetInput_Thread.Abort(); } catch (Exception E) { } }