Node.js proxy server socket hang up

一个人想着一个人 提交于 2019-12-13 08:26:26

问题


I am using Node.js as a proxy server and I cannot get rid of the following error. Can anyone familiar with NodeJS assist in finding a solution. Each time this happens I have to restart the .js proxy.

events.js:71
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: socket hang up
    at createHangUpError (http.js:1264:15)
    at CleartextStream.socketCloseListener (http.js:1315:23)
    at CleartextStream.EventEmitter.emit (events.js:93:17)
    at SecurePair.destroy (tls.js:938:22)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Thanks in advance for any assistance.


回答1:


This error happens sometimes, it's normal, because client/server can break connection by himself in a wrong way. You could listen for 'error' event on socket, so you can catch error and don't restart whole process.



来源:https://stackoverflow.com/questions/37052874/node-js-proxy-server-socket-hang-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!