Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

OTA: Explicitly set host IP to be used by client

Open krisrok opened this issue 2 years ago • 2 comments

This PR is a cleaned up version of what I outlined in #8510.

The python script explicitly transfers the host's IP to the client because the UdpContext did not reliably return the correct remote address.

I changed the meaning of the host_ip argument. Previously this was the IP the host's TCP socket binds to. Now it always binds to INADDR_ANY because why not -- I'm no expert in networking regards so this change has to be discussed. Instead of chaning the existing argument we could also introduce a new host_ip_remote or

Other than the host_ip it should be fully backwards compatible so you can use the new python script with the old cpp implementation and vice versa.

krisrok avatar Mar 16 '22 11:03 krisrok

As I understood the original ArduinoOTA ide, we are dealing with local updates. And we already have HTTP Update server; no need to transfer IP, it is a direct connection from the start.

Doing this seems like a weird workaround :/ I would not change the original host-ip purpose. Perhaps a better approach is to introduce another lib to do even more practical changes to the protocol?

mcspr avatar Jul 11 '22 20:07 mcspr

It is a workaround around the local network limitation, yes :)

If there are other, more viable ways to enable OTA via web, that‘d be great of course. I just needed the functionality at the time, was able to hack it together and thought I‘d share.

I did not see a real use case for the original host-ip argument. Maybe there are some, I don‘t know.

krisrok avatar Jul 12 '22 06:07 krisrok