how to handle net.connect's error callback when hostname is weird? #561
Replies: 3 comments
-
Posted at 2016-05-04 by ceremcem OK, I've succeded with the following code:
...Javascript:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-05-04 by @gfwilliams You might be able to do:
I think socket connections should time out eventually - it might take maybe 30 seconds or a minute though? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-05-04 by DrAzzy Yeah - it's an awkwardly long timeout. So if you're updating it too often (eg, in an interval), if the server goes down, it hoses everything. That's why I can't turn on some of the lights in my room if the webserver on the shelf in the living room isn't running. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-05-04 by ceremcem
Hi,
I found this conversation but I didn't find my answer in the replies.
When I try to connect to a valid server, my application works as expected and exchanges data. If I try to connect to an invalid server, for example
net.connect({host: "hello", port: 123}, function () {....
, then it hangs while trying to connect.How can I implement a timeout or something in order to fall back to a default server?
Beta Was this translation helpful? Give feedback.
All reactions