Record the ECONNRESET error and socket connection check in node.js

Sometimes I get this error when running my node.js script.

events.js:66
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: write ECONNRESET
    at errnoException (net.js:768:11)
    at Object.afterWrite (net.js:592:19)

What causes this error? I read something that this is caused by an attempt to write data to a private socket. Is it correct?

If so, How to check if socket connection is enabled? I found this SO question here , but no one answered it.

And thirdly, is it a simple attempt to catch the socket.write statement sufficient to handle this error? Or is it emitting errors that I have to handle?

+5
source share
1 answer
0

All Articles