Node.js node.connect()到irc.freenode.net后连接断开
我已连接到irc。但在连接后,它会立即断开连接,不会出现任何错误信息。怎么会这样 IRC日志:Node.js node.connect()到irc.freenode.net后连接断开,node.js,Node.js,我已连接到irc。但在连接后,它会立即断开连接,不会出现任何错误信息。怎么会这样 IRC日志: straysh (~mynick@li760-156.members.linode.com) has joined #Node.js straysh has quit (Remote host closed the connection) 我的控制台日志: straysh IRC-client]$node index.js Established connection, registering an
straysh (~mynick@li760-156.members.linode.com) has joined #Node.js
straysh has quit (Remote host closed the connection)
我的控制台日志:
straysh IRC-client]$node index.js
Established connection, registering and shit...
straysh IRC-client]$
这是我的密码:
/**
* Module Dependencies
*/
try{
var net= require('net');
var client = net.connect(6667, 'irc.freenode.net');
client.setEncoding('utf8');
client.setKeepAlive(true);
client.on('error', function(err){
console.log(err);
});
client.on('close', function(has_err){
console.log('connection gone...');
console.log(has_err);
});
client.on('connect', function(){
console.log('Established connection, registering and shit...');
setTimeout(function(){
client.write('NICK straysh\r\n');
client.write('USER mynick 0 * :realname\r\n');
client.write('JOIN #node.js\r\n');
}, 1000);
});
}catch( e ){
console.log(e);
}