本文整理匯總了C#中Tamir.SharpSsh.jsch.Session.disconnect方法的典型用法代碼示例。如果您正苦於以下問題:C# Session.disconnect方法的具體用法?C# Session.disconnect怎麽用?C# Session.disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tamir.SharpSsh.jsch.Session
的用法示例。
在下文中一共展示了Session.disconnect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: releaseSession
public void releaseSession(Session session)
{
if (session == null)
throw new System.ArgumentNullException ("session");
if (session.isConnected())
session.disconnect();
}
示例2: jschServer
/// <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;
}
}
示例3: releaseSession
public void releaseSession(Session session)
{
if (session.isConnected())
session.disconnect();
}