There is this that I wrotw many years ago: 
https://github.com/apache/nuttx-apps/tree/master/netutils/dhcpdSent from my 
Galaxy
-------- Original message --------From: michal.lyszc...@bofc.pl Date: 10/8/24  
11:01 PM  (GMT-06:00) To: dev@nuttx.apache.org Subject: Re: NuttX "gadget": 
resolve its host name via CDC/NCM connection 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, youmust 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 pushDNS server to the host via DHCP. Problem is, that 
now you will overwrite DNSaddress on your host pc and you won't be able to 
resolve anything else otherthan what your nuttx 'gadget' device can. You could 
forward requests toexternal DNS, but that again requires nuttx to have 
internet. So DHCP/DNS onnuttx is not really good option.Having it reversed 
(DHCP/DNS on host pc) could probably solve the problem withsome upnp magic. But 
that will require user to have upnp or some kind ofzeroconf 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 
notrecommend 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 
viaIP 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 
|`----------------------^--------------^----------------------^-----------------'

Reply via email to