On 2024-10-08 20:56:00, Tim Hardisty wrote:
> My intention is to implement a simple web server on the device so as to be
> able to plug in to it via usb, go to a browser, and go to “http://gadget”
> rather than “http://10.0.0.10” (for example).
> 
> This is DNS…but my embedded networking knowledge is limited and I am not
> sure what NuttX tools/daemons/examples/whatever I need to use for this? 
> 
> I don’t think a hosts file on the gadget is right, as the PC can’t use
> that to match hostname to IP (and editing a hosts file on the PC is not an
> option in this case). So probably the gadget needs to also be a DNS
> server? But I can’t find much information on how to use the NuttX
> implementation of this.
> 
> Have I got that right or am I missing something?

The thing you want to do, while possible is not really feasable. Yes, you
must host DNS server on nuttx. I don't think there is anything ready to go,
embedded devices usually do not act as a DNS. Then you would have to push
DNS server to the host via DHCP. Problem is, that now you will overwrite DNS
address on your host pc and you won't be able to resolve anything else other
than what your nuttx 'gadget' device can. You could forward requests to
external DNS, but that again requires nuttx to have internet. So DHCP/DNS on
nuttx is not really good option.

Having it reversed (DHCP/DNS on host pc) could probably solve the problem with
some upnp magic. But that will require user to have upnp or some kind of
zeroconf enabled on host pc as well.

To my knowledge it's not possible to do what you want in portable manner.
You can try some hacks, but the will not work for anyone - hence I would not
recommend them.

I have never ever met a embedded device that would do what you describe.
It's always via IP address. So do what others do, and allow access via
IP address only. That's the only portable way that I know of.

-- 
.-----------------.-------------------.----------------------.-----------------.
| Michal Lyszczek | Embedded C, Linux |   Company Address    |  .-. opensource |
| +48 727 564 419 | Software Engineer | Akacjowa 10a; 55-330 |  oo|  supporter |
| https://bofc.pl `----.--------------: Brzezinka Sredzka PL | /`'\      &     |
| GPG FF1EBFE7E3A974B1 | Bits of Code | NIP:   813 349 58 78 |(\_;/) programer |
`----------------------^--------------^----------------------^-----------------'

Attachment: signature.asc
Description: PGP signature

Reply via email to