Renci.SshNet.SshCommand.BeginExecute C# (CSharp) Method

BeginExecute() public method

Begins an asynchronous command execution.
Client is not connected. Operation has timed out.
public BeginExecute ( string commandText, AsyncCallback callback, object state ) : IAsyncResult
commandText string The command text.
callback AsyncCallback An optional asynchronous callback, to be called when the command execution is complete.
state object A user-provided object that distinguishes this particular asynchronous read request from other requests.
return IAsyncResult
        public IAsyncResult BeginExecute(string commandText, AsyncCallback callback, object state)
        {
            CommandText = commandText;

            return BeginExecute(callback, state);
        }

Same methods

SshCommand::BeginExecute ( ) : IAsyncResult
SshCommand::BeginExecute ( AsyncCallback callback ) : IAsyncResult
SshCommand::BeginExecute ( AsyncCallback callback, object state ) : IAsyncResult

Usage Example

コード例 #1
0
		private void BeginService()
		{
			_client = new SshClient(Host, UserName, Password);
			_client.Connect();
            _client.RunCommand("sudo pkill mono");
			var call = string.Format("cd {0}", _homePiBuildindicatronServer);
			const string commandText = "sudo mono BuildIndicatron.Server.exe";
			var text = call + " && " + commandText;
			_log.Info("Starting command:" + text);
			_runCommand = _client.CreateCommand(text);
			_beginExecute = _runCommand.BeginExecute();
			streamReader = new StreamReader(_runCommand.OutputStream);
			WaitFor("Running", 6000).Wait();
		}
All Usage Examples Of Renci.SshNet.SshCommand::BeginExecute