Created
September 12, 2016 03:14
-
-
Save hifi/d7c4e3689e28df13893fc0c4fd813706 to your computer and use it in GitHub Desktop.
SSH.NET SshCommand data writing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Renci.SshNet/SshCommand.cs b/src/Renci.SshNet/SshCommand.cs | |
index 292f67c..23c2d46 100644 | |
--- a/src/Renci.SshNet/SshCommand.cs | |
+++ b/src/Renci.SshNet/SshCommand.cs | |
@@ -307,6 +307,9 @@ namespace Renci.SshNet | |
throw new ArgumentException("EndExecute can only be called once for each asynchronous operation."); | |
} | |
+ // always send EOF when closing exec channel | |
+ _channel.SendEof(); | |
+ | |
// wait for operation to complete (or time out) | |
WaitOnHandle(_asyncResult.AsyncWaitHandle); | |
@@ -366,6 +369,26 @@ namespace Renci.SshNet | |
return Execute(); | |
} | |
+ /// <summary> | |
+ /// Sends the data to channel. | |
+ /// </summary> | |
+ /// <param name="data">Data.</param> | |
+ public void SendData(byte[] data) | |
+ { | |
+ SendData(data, 0, data.Length); | |
+ } | |
+ | |
+ /// <summary> | |
+ /// Sends the data with offset and size to channel. | |
+ /// </summary> | |
+ /// <param name="data">Data.</param> | |
+ /// <param name="offset">Offset.</param> | |
+ /// <param name="size">Size.</param> | |
+ public void SendData(byte[] data, int offset, int size) | |
+ { | |
+ _channel.SendData(data, offset, size); | |
+ } | |
+ | |
private IChannelSession CreateChannel() | |
{ | |
var channel = _session.CreateChannelSession(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment