首页 文章

套接字节点js出错

提问于
浏览
0

我在Node JS中使用library net来创建套接字服务器

所有的事情都很好,非常好 .

但它有时会出错

错误是:events.js:163 throw er; //未处理的'错误'事件^

错误:在TCP.onread(net.js:581:26)的exports._errnoException(util.js:1050:11)处读取ECONNRESET

1 回答

  • 1

    连接失效时触发此事件 . 你处理了服务器端关闭事件吗?像这样

    socket.on("close",function(){
     //you can't handle the network operation anymore after this by the socket object
    })
    

    在socket项目中,心跳测量是必要的 .

相关问题