本文整理汇总了C#中TargetInfo.GetPort方法的典型用法代码示例。如果您正苦于以下问题:C# TargetInfo.GetPort方法的具体用法?C# TargetInfo.GetPort怎么用?C# TargetInfo.GetPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TargetInfo
的用法示例。
在下文中一共展示了TargetInfo.GetPort方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public virtual void Connect(TargetInfo target)
{
this.CreateSSHExec(target);
try
{
this.SSHExec.Connect(target.GetPort());
}
catch (JSchException ex)
{
throw new SshConnectingException(
string.Format(
"Unable to connect to target machine {0} through port {1} using the user {2}. Check the target address (or host name), port number and that ssh service is running at target machine.",
target.GetAddress(), target.GetPort(), target.credentials.GetFullyQualifiedUsername()));
}
}
示例2: GetSystemInformationFrom
public SystemInformation GetSystemInformationFrom(TargetInfo target)
{
var sshExec = new SshExec(target.GetAddress(), target.credentials.GetUserName(), target.credentials.GetPassword());
sshExec.Connect(target.GetPort());
var collectedUnixSystemInformation = SystemInformationCollector.getSysInfo(sshExec);
return this.CreateSystemInformationInstance(collectedUnixSystemInformation);
}
示例3: GetSystemInformationFrom
public SystemInformation GetSystemInformationFrom(TargetInfo target)
{
var hostAddress = target.GetAddress();
var username = target.credentials.GetUserName();
var password = target.credentials.GetPassword();
var commandRunner = new SshCommandLineRunner(hostAddress, username, password, target.GetPort());
var collectedUnixSystemInformation = SystemInformationCollector.getSysInfo(commandRunner);
return CreateSystemInformationInstance(collectedUnixSystemInformation);
}
示例4: Connect
public virtual void Connect(TargetInfo target)
{
var connectionPort = target.GetPort(ConnectionType.Telnet);
this.TelnetConnection = new TelnetConnection(target.GetAddress(), connectionPort);
this.TelnetConnection.TimeOutLoginMs = 1000;
this.TelnetConnection.TimeOutReadMs = 30000;
this.TelnetConnection.CiscoLogin(target.credentials.GetUserName(), target.credentials.GetPassword());
string adminPass = target.credentials.GetAdminPassword();
if (!String.IsNullOrEmpty(adminPass))
this.TelnetConnection.CiscoEnable(adminPass);
}
示例5: Connect
public virtual void Connect(TargetInfo target)
{
this.SshCommandLineRunner = CreateSshCommandLineRunner(target);
try
{
this.SshCommandLineRunner.Connect();
}
catch (Exception ex)
{
throw new SshConnectingException(
string.Format(
"Unable to connect to target machine {0} through port {1} using the user {2}. Check the target address (or host name), port number and that ssh service is running at target machine. Error Message: '{3}'",
target.GetAddress(), target.GetPort(), target.credentials.GetFullyQualifiedUsername(), ex.Message));
}
}
示例6: CreateSshCommandLineRunner
private SshCommandLineRunner CreateSshCommandLineRunner(TargetInfo target)
{
var hostAddress = target.GetAddress();
var sshPort = target.GetPort();
var username = target.credentials.GetUserName();
var password = target.credentials.GetPassword();
return new SshCommandLineRunner(hostAddress, username, password, sshPort);
}