/// <exception cref="System.IO.IOException"></exception> public virtual InputStream GetExtInputStream() { PipedInputStream @in = new Channel.MyPipedInputStream(this, 32 * 1024); // this value should be customizable. io.SetExtOutputStream(new Channel.PassiveOutputStream(this, @in), false); return(@in); }
/// <exception cref="NSch.JSchException"></exception> public override void Start() { try { PipedOutputStream pos = new PipedOutputStream(); io.SetOutputStream(pos); PipedInputStream pis = new Channel.MyPipedInputStream(this, pos, 32 * 1024); io.SetInputStream(pis); io_in = io.@in; if (io_in == null) { throw new JSchException("channel is down"); } Request request = new RequestSftp(); request.DoRequest(GetSession(), this); buf = new Buffer(rmpsize); packet = new Packet(buf); int i = 0; int length; int type; byte[] str; // send SSH_FXP_INIT SendINIT(); // receive SSH_FXP_VERSION ChannelHeader header = new ChannelHeader(this); header = Header(buf, header); length = header.length; if (length > MAX_MSG_LENGTH) { throw new SftpException(SSH_FX_FAILURE, "Received message is too long: " + length ); } type = header.type; // 2 -> SSH_FXP_VERSION server_version = header.rid; //System.err.println("SFTP protocol server-version="+server_version); if (length > 0) { extensions = new Hashtable(); // extension data Fill(buf, length); byte[] extension_name = null; byte[] extension_data = null; while (length > 0) { extension_name = buf.GetString(); length -= (4 + extension_name.Length); extension_data = buf.GetString(); length -= (4 + extension_data.Length); extensions.Put(Util.Byte2str(extension_name), Util.Byte2str(extension_data)); } } lcwd = new FilePath(".").GetCanonicalPath(); } catch (Exception e) { //System.err.println(e); if (e is JSchException) { throw (JSchException)e; } if (e is Exception) { throw new JSchException(e.ToString(), (Exception)e); } throw new JSchException(e.ToString()); } }
/// <exception cref="System.IO.IOException"></exception> public virtual InputStream GetExtInputStream() { PipedInputStream @in = new Channel.MyPipedInputStream(this, 32 * 1024); // this value should be customizable. io.SetExtOutputStream(new Channel.PassiveOutputStream(this, @in), false); return @in; }