Arm Mbed OS support forum

How to set device network hostname on MBED OS 6?

How can I set the device hostname properly using MBED OS 6?

In the olden days (MBED OS 2) one solution was to change EthernetInterface.cpp file and header file as described here:

I´d expected new functions/methods to implement this function. I’m working with LPC1768, but apparently this feature is not supported by the OS, even with latest platforms.

Thanks for all your suggestions.

+1 I would also like to know the solution to this.

+2, I have been waiting also. I ran across a comment somewhere that it was supposed to be showing up in MBED OS 6.

I have been using the following since MBED OS 5.9. It’s not a long term solution as it could break down the road and a little bit of a brute force method.

#include “mbed.h”
#include “EthernetInterface.h”
#include “netif.h”

EthernetInterface net;

netif_set_hostname(netif_default, “myhostname”);

Still waiting a solution :cry:.

Thanks for your suggestion @tim35ca, this workaround freezes at net.disconnect() using MBED OS 6.3 and LPC1768.

Hello Mauricio,

I might be wrong but the friendly name is usually assigned to a host by DNS (Domain Name System/Server). However, for small local networks the mDNS (Multicast DNS) can be used as a workaround . A search for mDNS on Mbed pages returns several libraries. Maybe some of them work also with Mbed OS 6. I think it’s worth to try out.

Best regards, Zoltan

Does this solution still work?

Or are you looking for a new solution because it stopped working?

I have only been able to go to 6.2.1 for a number of my solutions. There are quite a few problems with the 6.3 release (only tried the online compiler). I haven’t pulled 6.3 into mbed studio yet.