public SshCommand CreateCommand(string commandText, Encoding encoding) { EnsureSessionIsOpen(); ConnectionInfo.Encoding = encoding; return new SshCommand(Session, commandText, encoding); }
/// <summary> /// ListenPort /// </summary> /// <returns></returns> public string ListenPort() { Constants.log.Info("Entering SshListener ListenPort Method!"); string response = string.Empty; if (_sshClient == null && _connInfo == null) { Constants.log.Info("Calling SshListener InitializeListener Method!"); InitializeListener(); } try { _sshClient = new SshClient(_connInfo); _sshClient.Connect(); response = _sshClient.CreateCommand(this.Command).Execute(); } catch (Exception ex) { Constants.log.Error(ex.Message); response = ex.Message; } Constants.log.Info("Exiting SshListener ListenPort Method!"); return response; }