Network disruption

Posted on
  • I am trying to make my things resistive to all sort of annoyances that can occour. Currently I am working on network disruptions, when the wireless router is still responsive but cannot connect to the internet. While I use websocket connections I saw that the websocket module wants to create a socket connection using net.connect(), but unfortunately I could not find any possibility to detect this condition in the documentation. I get just a message at the console:

    ERROR: Connect failed (err 113)
    Uncaught InternalError: Unable to create socket
    

    I don't know whether this is specific on the ESP32.

  • You want to look at wifi.ping to an address on the Internet - depending on the response you can work out if you have an Internet connection

  • I tried this on a ESP8266 where it is working with a ip address. In the docs it states the parameter should be 'hostname', but when I try with a hostname I get an error:

    w.ping('google.com', (details) => { console.log(details) });
    Uncaught Error: Not a valid IP address.
    

    When I try this on a ESP32 I get:

    w=require('Wifi')
    =function () { [native code] }
    >w.ping('212.51.158.12', (details) => { console.log(details) });
    Uncaught Error: Function "ping" not found!
    

    Both ESP's are running espruino 2v00

    The ping method may work for me when it would be available on both platforms however it's somewhat tricky, because you can not decide how many pings are issued.

    Where could I find the source code of the 'net' Library?

  • Sorry - ping was only recently added to the esp32 build - it might not be on a release build yet - which firmware are you on the esp32?

  • I am running under 2v00

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Network disruption

Posted by Avatar for fanThomas @fanThomas

Actions