-
Notifications
You must be signed in to change notification settings - Fork 7.3k
net/tls KeepAlive does not work as expected #6194
Comments
It works as expected - though maybe not as you expect it to. :-) Quoting
That is, TCP keep-alive is basically a timer that, once it expires, tells you the connection is dead. Node.js could perhaps make keep-alive a little more configurable. Linux supports TCP_KEEPCNT, TCP_KEEPIDLE and TCP_KEEPINTVL, the BSDs have TCP_KEEPALIVE, Solaris has TCP_KEEPALIVE, TCP_KEEPALIVE_THRESHOLD and TCP_KEEPALIVE_ABORT_THRESHOLD, Windows has... well, who knows? Still, that won't let you magically detect a severed connection at the time of the disconnect itself because that's simply not how TCP works. |
Ok, so indeed, after ~10 minutes, Node emits an error: Thanks! |
Quoted from TCP keepalive HowTo:
So the following code SHOULD throw something when the internet connection is broken:
Tested on MacOS/Debian, with NodeJS v0.10.17
The text was updated successfully, but these errors were encountered: