0
// Sample FTP Code
// ------------------
try {
    const Client = require('ssh2').Client;
    const conn = new Client();

    var ftpConfig = {
        host: 'ip',
        port: port,
        username: 'username',
        password: 'password'
        , readyTimeout: 5000
        
    }
    conn.on('ready', () => {
        console.log('Client :: ready');
        conn.sftp((err, sftp) => {
            if (err) throw err;
            sftp.readdir('foo', (err, list) => {
                if (err) throw err;
                console.dir(list);
                conn.end();
            });
        });
    }).connect(ftpConfig);

} catch (error) {
    console.log(error, '============ Catch Error ==============');
}

错误

级别:“客户端超时”
消息:“等待握手时超时”
堆栈:“错误:在超时等待握手时超时。_onTimeout(C:\用户\rabeeshv\桌面\Rabeessh\Samples\node_modules\ssh2\ lib\client.js:993:23) 在 listOnTimeout (internal/timers.js:549:17) 在 processTimers (internal/timers.js:492:7)"

4

0 回答 0