Renci.SshNet.Channels.ChannelForwardedTcpip.Close C# (CSharp) Method

Close() protected method

Closes the channel waiting for the SSH_MSG_CHANNEL_CLOSE message to be received from the server.
protected Close ( ) : void
return void
        protected override void Close()
        {
            var forwardedPort = _forwardedPort;
            if (forwardedPort != null)
            {
                forwardedPort.Closing -= ForwardedPort_Closing;
                _forwardedPort = null;
            }

            // signal to the server that we will not send anything anymore; this will also interrupt the
            // blocking receive in Bind if the server sends FIN/ACK in time
            //
            // if the FIN/ACK is not sent in time, the socket will be closed after the channel is closed
            ShutdownSocket(SocketShutdown.Send);

            // close the SSH channel, and mark the channel closed
            base.Close();

            // close the socket
            CloseSocket();
        }