public InputStreamGet( ChannelSftp sftp, byte[] handle, SftpProgressMonitor monitor) { this.sftp = sftp; this.handle = handle; this.monitor = monitor; }
internal OutputStreamPut(ChannelSftp sftp, byte[] handle, long[] _offset, SftpProgressMonitor monitor) : base() { this.sftp=sftp; this.handle=handle; this._offset=_offset; this.monitor=monitor; }
internal OutputStreamPut (ChannelSftp sftp, byte[] handle, long[] _offset, SftpProgressMonitor monitor) : base() { this.sftp = sftp; this.handle = handle; this._offset = _offset; this.monitor = monitor; }
protected void _Connect() { _jsch = new JSch(); //session.setConfig(); _session = _jsch.getSession(this.Username, this.Host, this.Port); UserInfo ui = new DirectPasswordUserInfo(this.Password); _session.setUserInfo(ui); _session.connect(); _csftp = (ChannelSftp)_session.openChannel("sftp"); _csftp.connect(); //RootPath = csftp.getHome(); RootPath = ""; }
//连接SFTP public bool Connect() { try { if (!Connected) { m_session.connect(); m_channel = m_session.openChannel("sftp"); m_channel.connect(); m_sftp = (ChannelSftp)m_channel; } return true; } catch { return false; } }
public override void Shutdown() { if (_csftp != null) { _csftp.disconnect(); _csftp = null; } if (_session != null) { _session.disconnect(); _session = null; } if (_jsch != null) { _jsch = null; } }
//连接SFTP public bool Connect() { try { if (!Connected) { m_session.connect(); m_channel = m_session.openChannel("sftp"); m_channel.connect(); m_sftp = (ChannelSftp)m_channel; } return true; } catch (Exception ex) { Console.WriteLine("host:" + m_session.getHost() + "port:" + m_session.getPort()); Console.WriteLine(ex.Message); throw new Exception(ex.Message + "\r\n" + "host:" + m_session.getHost() + "port:" + m_session.getPort()); //return false; } }
private void CleanUp() { if (_ftp != null) { try { if (_ftp.isConnected()) _ftp.disconnect(); } finally { _ftp = null; } } #if DEBUG GC.SuppressFinalize(this); // Disarm lock-release checker #endif }
private SftpObjectDatabase(SftpObjectDatabase parent, string p, TransportSftp instance) { this._instance = instance; try { _ftp = instance.NewSftp(); _ftp.cd(parent._objectsPath); _ftp.cd(p); _objectsPath = _ftp.pwd(); } catch (TransportException) { CleanUp(); throw; } catch (SftpException je) { throw new TransportException("Can't enter " + p + " from " + parent._objectsPath + ": " + je.message, je); } }
public SftpObjectDatabase(string path, TransportSftp instance) { this._instance = instance; if (path.StartsWith("/~")) { path = path.Substring(1); } if (path.StartsWith("~/")) { path = path.Substring(2); } try { _ftp = instance.NewSftp(); _ftp.cd(path); _ftp.cd("objects"); _objectsPath = _ftp.pwd(); } catch (TransportException) { CleanUp(); throw; } catch (SftpException je) { throw new TransportException("Can't enter " + path + "/objects: " + je.message, je); } }
public InputStreamGet( ChannelSftp sftp, byte[] handle, SftpProgressMonitor monitor) { this.sftp=sftp; this.handle=handle; this.monitor=monitor; }
public override void close() { if (_ftp != null) { try { if (_ftp.isConnected()) _ftp.disconnect(); } finally { _ftp = null; } } #if DEBUG GC.SuppressFinalize(this); // Disarm lock-release checker #endif }
public override void close() { if (_ftp != null) { try { if (_ftp.isConnected()) _ftp.disconnect(); } finally { _ftp = null; } } }
private void Conectar() { JSch jsch = new JSch(); Hashtable propiedades = new Hashtable(); this.session=jsch.getSession(this.user, this.host, this.port); this.session.setPassword(this.psw); this.session.setTimeout(this.timeOut); propiedades.Add("password", this.psw); propiedades.Add("StrictHostKeyChecking", "no"); this.session.setConfig(propiedades); this.session.connect(); this.canal = session.openChannel("sftp"); this.canal.connect(); this.canalsftp = (ChannelSftp)canal; }
private void sftp_login() { JSch jsch = new JSch(); String host = tHost.Text; String user = tUsername.Text; Session session = jsch.getSession(user, host, 22); // username and password will be given via UserInfo interface. UserInfo ui = new MyUserInfo(); session.setUserInfo(ui); session.setPort(Convert.ToInt32(nPort.Value)); session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); sftpc = (ChannelSftp)channel; }
///SFTP Code Starting here ///hell yeah private void sftp_login() { JSch jsch = new JSch(); String host = ftpHost(); String user = ftpUser(); Session session = jsch.getSession(user, host, 22); // username and password will be given via UserInfo interface. UserInfo ui = new MyUserInfo(); session.setUserInfo(ui); session.setPort(ftpPort()); session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); sftpc = (ChannelSftp)channel; //sftpc = (ChannelSftp)channel; }
private void sftp_login() { JSch jsch = new JSch(); host = ((frmMain)this.Tag).ftpHost(); UN = ((frmMain)this.Tag).ftpUser(); port = ((frmMain)this.Tag).ftpPort(); Session session = jsch.getSession(UN, host, 22); // username and password will be given via UserInfo interface. UserInfo ui = new MyUserInfo(); session.setUserInfo(ui); session.setPort(port); session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); sftpc = (ChannelSftp)channel; }