public void Dispose() { try { OnClosed(Guid); Stream.Close(); Stream.Dispose(); Sock.Close(); Sock.Dispose(); clientThread.Abort(); clientThread.Join(); } catch (ThreadAbortException ex) { string exMsg = string.Empty; exMsg = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ":" + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + ex.StackTrace + Environment.NewLine + System.Reflection.MethodBase.GetCurrentMethod().Name + "():" + ex.Message; Console.WriteLine("THREAD ABORT ERROR :: " + exMsg); } catch (Exception ex) { string exMsg = string.Empty; exMsg = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ":" + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "." + ex.StackTrace + Environment.NewLine + System.Reflection.MethodBase.GetCurrentMethod().Name + "():" + ex.Message; Console.WriteLine("Dispose ERROR :: " + exMsg); } }
public void Dispose() { Reader.Dispose(); Stream.Dispose(); Sock.Close(); Sock.Dispose(); Lock.Dispose(); }
public void Stop() { Closing = true; Stream.Close(); Sock.Close(); Stream.Dispose(); Sock.Dispose(); }