node-imap icon indicating copy to clipboard operation
node-imap copied to clipboard

socket.setKeepAlive(true)

Open qiuzhis opened this issue 6 years ago • 3 comments

hello { Error: read ECONNRESET (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read', syscall: 'read', source: 'socket' }

I see the new Socket() KeepAlive is set default true,why not read myConfig.KeepAlive .

qiuzhis avatar Jan 10 '20 02:01 qiuzhis

I'm not sure what the issue is here. setKeepAlive(true) should not cause such an error in normal operation. It's used to help detect dead connections. As long as you have an 'error' event handler, that's what's important. I should also point out that sometimes this error occurs even during normal disconnection and is either the server severing the connection abruptly for whatever reason or possibly (but less likely) a bug in node.js.

mscdex avatar Jan 10 '20 03:01 mscdex

yes,I know.I mean setKeepAlive(config.keepalive) .I guess long Persistent Connection is lost,But MyClinet is not know.so I want to close long Persistent Connection . yet My idea is wrong . thanks

qiuzhis avatar Jan 10 '20 03:01 qiuzhis

setKeepAlive() is a TCP-level mechanism. In general you can close the connection at any time that you want.

mscdex avatar Jan 10 '20 03:01 mscdex