Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Close()
- {
- if (Logging.On)
- {
- Logging.Enter(Logging.Sockets, this, "Close", "");
- }
- ((IDisposable)this).Dispose();
- if (Logging.On)
- {
- Logging.Exit(Logging.Sockets, this, "Close", "");
- }
- }
- void IDisposable.Dispose()
- {
- this.Dispose(true);
- }
- protected virtual void Dispose(bool disposing)
- {
- if (Logging.On)
- {
- Logging.Enter(Logging.Sockets, this, "Dispose", "");
- }
- if (this.m_CleanedUp)
- {
- if (Logging.On)
- {
- Logging.Exit(Logging.Sockets, this, "Dispose", "");
- }
- return;
- }
- if (disposing)
- {
- IDisposable dataStream = this.m_DataStream;
- if (dataStream != null)
- {
- dataStream.Dispose();
- }
- else
- {
- Socket client = this.Client;
- if (client != null)
- {
- try
- {
- client.InternalShutdown(SocketShutdown.Both);
- }
- finally
- {
- client.Close();
- this.Client = null;
- }
- }
- }
- GC.SuppressFinalize(this);
- }
- this.m_CleanedUp = true;
- if (Logging.On)
- {
- Logging.Exit(Logging.Sockets, this, "Dispose", "");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment