Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 4 months ago.
how to print netmask and gateway?
how do you print the "NETMASK" and "Gateway" in EthernetInterface?
printing IP is relatively
printf("IP Address is %s\n", eth.getIPAddress());
but for netmask and gateway?
1 Answer
11 years, 2 months ago.
EthernetInterface can be enhanced to allow this.
Looking at the implementation for EthernetInterface.getIPAddress(), leads to netif_status_callback() which fills in the IP address when DHCP completes from the netif structure. Similarly, you can extract the netmask and gw from the same structure, store in locals, and implement getGateway() and getNetmask() so you can retrieve them.