Arm Mbed OS support forum

DNS issue with mbed-http

Hi,

I have a weird issue on Ethernet interface.
Indeed, I connect my Nucleo-F767ZI board through an ethernet connection in DHCP.
It works almost well, indeed the ip address, gateway, netmask are ok but the DNS server is NULL.
If I connect my laptop to the same network cable then the DNS is set with the same IP as the gateway.
So, why the DNS is empty in DHCP mode ?

Here is my code:

_ethernetInterface.set_dhcp(true);

_ethernetInterface.connect();   

nsapi_connection_status status = _ethernetInterface.get_connection_status();

printf("Status = %d\r\n", status);

SocketAddress address;

_ethernetInterface.get_ip_address(&address);

printf("IP : %s\r\n", address.get_ip_address() ? address.get_ip_address() : "None");

SocketAddress netmask;

_ethernetInterface.get_netmask(&netmask);

SocketAddress addressGateway;

_ethernetInterface.get_gateway(&addressGateway);

printf("IP Gateway : %s\r\n", addressGateway.get_ip_address() ? addressGateway.get_ip_address() : "None");

SocketAddress addressDns;

_ethernetInterface.get_dns_server(0, &addressDns);

printf("IP DNS = %s\r\n", addressDns.get_ip_address() ? addressDns.get_ip_address() : "None");

Thanks
Frédéric