Renci.SshNet.SshClient.CreateCommand C# (CSharp) Method

CreateCommand() public method

Creates the command to be executed.
Client is not connected.
public CreateCommand ( string commandText ) : SshCommand
commandText string The command text.
return SshCommand
        public SshCommand CreateCommand(string commandText)
        {
            return CreateCommand(commandText, ConnectionInfo.Encoding);
        }

Same methods

SshClient::CreateCommand ( string commandText, Encoding encoding ) : SshCommand

Usage Example

Beispiel #1
0
        /// <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;
        }
All Usage Examples Of Renci.SshNet.SshClient::CreateCommand