当前位置: 首页>>代码示例>>C#>>正文


C# TargetInfo.GetPort方法代码示例

本文整理汇总了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()));
     }
 }
开发者ID:ywcsz,项目名称:modSIC,代码行数:15,代码来源:SSHConnectionProvider.cs

示例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);
        }
开发者ID:ywcsz,项目名称:modSIC,代码行数:9,代码来源:UnixSystemInformationService.cs

示例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);
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:10,代码来源:UnixSystemInformationService.cs

示例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);
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:12,代码来源:CiscoIOSConnectionProvider.cs

示例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));
     }
 }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:15,代码来源:SSHConnectionProvider.cs

示例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);
        }
开发者ID:jonaslsl,项目名称:modSIC,代码行数:9,代码来源:SSHConnectionProvider.cs


注:本文中的TargetInfo.GetPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。