Host ID name in Ethernet Client Stack

07 Nov 2010

Could someone help me with the correct statement for reporting the MBED Host Name?

I am using EthernetNetIf and HTTPClient in my program.  - Do I edit something in these?

My application will have more than one MBED on the network - I would like to see the Host ID name in the DHCP table.

I am stuck....

Thanks!

Jeff

07 Nov 2010 . Edited: 07 Nov 2010

Hi Jeff

As a starting point, have a look at line 0091 in this file. It looks like Donatien was thinking to add this functionality, but it's not all there yet.

Regards

08 Nov 2010

Yeah....I edited the // out of line 0091 and got many compiler errors....fixed them and still no luck.

Thanks for your help.....will sleep on the idea and maybe it will come to me.

 

Jeff

08 Nov 2010 . Edited: 08 Nov 2010

Hi Jeff

Hope you didn't lose too much sleep. I had a look more closely; you need to change the source in two places.

At line 91 in if/eth/EthernetIf.cpp:

 m_pNetIf->hostname = "mbedSE";

Also, you need to enable the hostname option in lwip/lwipopts.h. Add the following line (I did it at line 336):

 

#define LWIP_NETIF_HOSTNAME     1

That's it; I got the the hostname appearing in my router DHCP table.

Have a play with that to see. I'll fix up the class so you can pass in a hostname rather than hardcoding it.

Regards

09 Nov 2010

Segundo,

It works!

Thanks.

Jeff

09 Nov 2010

Hi Jeff

I've made the hostname settable in the EthernetNetIf DHCP constructor, and published the library (for a few other reasons as well). Please have a look here.

Regards