Org.Mentalis.Proxy.Client.Dispose C# (CSharp) Method

Dispose() public method

Disposes of the resources (other than memory) used by the Client.
Closes the connections with the local client and the remote host. Once Dispose has been called, this object should not be used anymore.
public Dispose ( ) : void
return void
        public void Dispose()
        {
            try {
            ClientSocket.Shutdown(SocketShutdown.Both);
            } catch {}
            try {
            DestinationSocket.Shutdown(SocketShutdown.Both);
            } catch {}
            //Close the sockets
            if (ClientSocket != null)
            ClientSocket.Close();
            if (DestinationSocket != null)
            DestinationSocket.Close();
            //Clean up
            ClientSocket = null;
            DestinationSocket = null;
            if (Destroyer != null)
            Destroyer(this);
        }