disconnect() public method

public disconnect ( ) : void
return void
Beispiel #1
0
        public void releaseSession(Session session)
        {
            if (session == null)
                throw new System.ArgumentNullException ("session");

            if (session.isConnected())
                session.disconnect();
        }
Beispiel #2
0
        /// <summary>
        ///  This class creates a jsch instance using the host that user wants. This makes it possible to
        ///  forward the MySql Database port to a user's local port.
        /// </summary>
        public string jschServer(string host, string user, string password)
        {
            try
            {
                // Create a new JSch instance
                JSch jsch = new JSch();

                // Saves the info to make other sessions
                this.host = host;
                this.user = user;
                this.password = password;

                // Create a new SSH session
                session = jsch.getSession(user, password, port);
                session.setHost(host); ;
                session.setPassword(password);

                // Creates a userinfo instance to pass into the session
                UserInfo ui = new MyUserInfo();
                session.setUserInfo(ui);

                session.connect();

                return null;
            }
            catch (Exception ex)
            {
                session.disconnect();
                return ex.Message;
            }
        }
 public void releaseSession(Session session)
 {
     if (session.isConnected())
         session.disconnect();
 }