I have a net client connection to a socket (using net.createConnection(port,host). this works fine.
However, sometimes there is the possibility of the server dropping the connection, and I would like the net connection to automatically reconnect when the server is back up and running
I can trap the on('end') event to catch the initial disconnect, and try to reconnect.
However,how can I check to see if the client has connected, because I want to retry every n milliseconds on a backoff strategy
In your end
handler, set a timeout that will retry the connection, and set a one time connect
handler that will cancel the timeout.