Good morning,
I have an ESP32 that works 24h/24, which I can update with vscode remotely (OTA) from the local network.
On the same home LAN I have a NAS with reverse proxy. So from the internet, a:
ping esp.xxx.synology.me
reaches the NAS
My question: is it possible to reprogram the ESP32 from the internet?
Hello
Sorry I don’t understand the first point. I did not enter this instruction anywhere.
And no, I did not modify the env[“PROGNAME”] paragraph in the platformio.ini file.
I don’t know if Synology’s reverse proxy sends messages in UDP because I have configured it as follows :
Besides, I haven’t opened any particular ports on my internet box. I thought it was not useful because I am accessing all machines on my local network correctly.
But neither the destination not source protocol is HTTP. And if you configured the SRC to be on port 80, then you would also need to tell PlatformIO to access that port from the outside. Do you have the option to setup a 1:1 relationship between Source UDP 3232 and Destination UDP 3232? That should make it work without modifications.
Hello
I just changed the settings of my internet box to transfer everything that comes in UDP port 3232 to my esp with the same port 3232.
Obviously it’s a little bit better
Oh, actually this process is more complicated. It starts off with UDP, but then it will ask the ESP to connect to the given TCP server port opened by the computer, i.e., from the ESP32 (source port probably random) to the computer, target port 23524 in this case. See source code. This port number is however random
So what you should do:
Use upload_flags in the platformio.ini to add --host_port, then it should have a fixed TCP server port on the PC side
Make another rule so that the ESP32 can reach your computer’s TCP server port as decided above
First, thank you Maxgerhardt for your help !
Then, I’ve fixed host_port in platformio.ini
upload_port = 176.xxx.yyy.zzz ; it's the IP adress of my internet box
upload_flags =
--port=3232
--auth=password
--host_port=22564 ; selected by me
upload_protocol = espota
Then something is still wrong with the port forwarding. I guess you could a very minimal sketch for the ESP32 (uploaded via serial) that tries to connect to TCP 22564 on your computer’s IP address (e.g. derived from this) while a minimal TCP server is opened by e.g. this program.