On Espruino WiFi boards you can use wifi.setHostName to set a host name, so that if DNS is working properly on your home network you can just access the device via that name. http://www.espruino.com/Reference#l_Wifi_setHostname
Unfortunately I don't think that's on the ESP8266 yet as we're trying to get a more general-purpose solution using JS, but there is some info and a gist on https://github.com/espruino/Espruino/issues/1376 that might work.
However if you have a server that you know the IP address of or that is available via DNS, I'd just POST your IP (which you can get with wifi.getIP(...)).
I am having hard time to get the external ip(the public ip of my modem)
You'll find that when you post it to your web server, the web server itself should know the IP address of the client that is connecting to it, and you can get it that way.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
On Espruino WiFi boards you can use
wifi.setHostName
to set a host name, so that if DNS is working properly on your home network you can just access the device via that name. http://www.espruino.com/Reference#l_Wifi_setHostnameUnfortunately I don't think that's on the ESP8266 yet as we're trying to get a more general-purpose solution using JS, but there is some info and a gist on https://github.com/espruino/Espruino/issues/1376 that might work.
However if you have a server that you know the IP address of or that is available via DNS, I'd just POST your IP (which you can get with
wifi.getIP(...)
).You'll find that when you post it to your web server, the web server itself should know the IP address of the client that is connecting to it, and you can get it that way.