I have an Ubuntu server with ip address 10.4.0.10. my node.js is installed on a WindowsXP desktop. from this desktop, I can ftp and telnet this Ubuntu server manually. but with node.js, I just found output from spawn 'ftp' . there's no any response from spawn 'telnet'
var proc = require('child_process').spawn('ftp',['10.4.0.10']);
proc.stdout.on('data', function (data) {
console.log('got data stdout:', data.toString('utf-8'));
});
proc.on('exit', function (code) {
console.log('process exited with code ' + code + " pid:" + proc.pid);
});
output:
got data stdout: User (10.4.0.10:(none)):
if change var proc = require('child_process').spawn('ftp',['10.4.0.10'])
to
var proc = require('child_process').spawn('telnet',['10.4.0.10']);
I got the output like this:
process exited with code -1 pid:3048
I have no idea why this didn't work when spawn 'telnet'. Would anybody help me ? thanks