Detect disconnection in node net.socket

Viewed 72

I'm developing an application using nodejs.

The application needs to use a TCP connection so I'm using the net library. Everything works fine but if I disconnect the ethernet cable, the socket does not notify me.

Is there a way to get notified when the connection is lost? I tryed every event listed in the documentation but none of them fires when I disconnect the ethernet cable.

I would like to not implement a polling.

Thanks a lot!

0 Answers
Related