Have you tried socket.setKeepAlive? I think this enables the TCP- level keepalive flag (SO_KEEPALIVE) which should cause an OS-level TCP disconnect much sooner. Doing a netstat -nop, it seems that every TCP connection on my server except those made by node have this flag enabled, so it seems the default in most situations, and without it you may never get a notification (until you write some data to the socket and the OS fails to send it, I think). A hardware restart will not send FIN or RST.
An app-level ping, causing data to be written to the socket at some regular interval should also allow you to be notified sooner (because if the other end has been restarted, TCP will almost immediately know when it tries to send data). On Apr 9, 12:32 am, Ben Noordhuis <[email protected]> wrote: > On Mon, Apr 9, 2012 at 06:19, Chirag A <[email protected]> wrote: > > nope .. the close event is fired with has_error flag as false .... > > I also tried using socket with allowhalfopen = false .. but no luck ! > > It sounds like the server doesn't send a FIN or RST packet. You should > be able to verify that with wireshark or tcpdump. > > If that's the case, the client (Node) won't find out that the > connection is down until later. Possibly much later. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
