Example #1
0
 public void Disconnect()
 {
     RecieverThread?.Abort();
     Stream?.Flush();
     Stream?.Close();
     Client?.Close();
 }
Example #2
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    Writer?.Close();
                    Reader?.Close();
                    Client?.Close();
                }

                disposedValue = true;
            }
        }