Isn't there Bonjour/Avahi that can make something like this work on a local network, at least when accessed from a computer that supports Bonjour/Avahi? I think this is how printers are automatically discovered on a network.
On Wed, Oct 9, 2024 at 9:02 AM Tim Hardisty <timhardist...@gmail.com> wrote: > > Yes - I think mDNS might be a good way so I am looking at this. If I get > it working can work on a PR to add such a thing as a NETUTIL and/or > example :-) > > “http://gadget.local <http://gadget.local/>" is fine and (probably) correct > anyway. > > On 09/10/2024 07:34, David Alessio wrote: > >> On Oct 8, 2024, at 12:56 PM, Tim Hardisty<timhardist...@gmail.com> wrote: > >> > >> Not a NuttX question, as such, more a basic embedded device networking > >> question. But you’re all so helpful, and it’s NuttX things I need to do > >> this :-) > >> > >> I have just tried the recently added CDC/NCM USB networking and it works > >> very nicely. Coupled with DHCPD, I can have a PC (Windows or Linux; not > >> tried MAC yet) get an IP address and immediately I can exchange data > >> (well…ping between them). And I have set a hostname for my NuttX “gadget” > >> and uname reports it properly. > >> > >> 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? > >> > >> Happy to repay “information that leads to a successful prosecution” ;-) by > >> adding to the NuttX “How To” documentation if appropriate > >> > >> Thanks, > >> > >> TimJTi. > > The first thought that comes to my mind is to run an mDNS responder on the > > NuttX side. Its hostname will need to be “gadget”. You may need to settle > > for “http://gadget.local <http://gadget.local/>"