Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js node.connect()到irc.freenode.net后连接断开_Node.js - Fatal编程技术网

Node.js node.connect()到irc.freenode.net后连接断开

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

我已连接到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 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);
}