Private Sub ChatWindow_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If Mode = mode.Server Then ServerSocket.Stop() End If NetworkStream.Close() ClientSocket.Close() End Sub
using (TcpClient tcpClient = new TcpClient()) { if (tcpClient != null) { tcpClient.GetStream().Close(); tcpClient.Close(); tcpClient = null; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)