How to send HOSTNAME to Router? #2558
-
Another dumb Question: Now I´m looking for a way to announce the HOSTNAME of my Device to the Router. On ESP32 this is done when connecting to WiFi. But how can it be done with build-in TCP-Stack? Thanks for Answers |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Do you know what that means and the options available ? What exactly do you mean by that ? Routers do not "know" hostnames (nor hosts, btw), routers know networks. What is "the router" to you ? What exactly do you want to do ? That is not "done by ESP32", it doesn't do magic nor abstract stuff to please you; what exactly do you want to do ? Do you have a DNS ? Do you know how DNS works ? mDNS ? NetBIOS ? SSDP ? Port forwarding ? I have a limited imagination, I may have left one or two (hundred) options out. |
Beta Was this translation helpful? Give feedback.
-
To do things properly, you should have a DNS server. Lines 267 to 281 in b8bfa55 You can change that. |
Beta Was this translation helpful? Give feedback.
-
That one is a short hardcoded hack of a function, it isn't that easy to change. You'll see there are some hardcoded offsets there that you need to take care of if you change the text. And... '3' will no longer be '3' before your host name... take a look at the DHCP request message structure. |
Beta Was this translation helpful? Give feedback.
To do things properly, you should have a DNS server.
Some DNS and DHCP servers integrate together. Your router probably does that. I don't know if relying on user-given host names is standard, considered good practice, or even allowed. Sounds insecure to me, but looks fine for a (closed) home network
Mongoose does not have mDNS nor SSDP support, but no one is stopping you from broadcasting UDP datagrams.
In Windows environments, some people run a netbios name server (or however it is called these days) and Windows machines used to resolve with those queries. Not a standard, but used to work
We use a bogus hostname, are you able to reach your board at http://mip ?
mongoose/src/net_built…