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.
10 years, 7 months ago.
EthernetInterface find IP
Hello, We're using an Arch Pro development board with the "EthernetInterface.h" library. We want to know how to find the IP adress of the board to go on the server.
1 Answer
10 years, 7 months ago.
getIPAddress() returns a char* to a string containing the IP address.
#include "mbed.h" #include "EthernetInterface.h" EthernetInterface eth; Serial pc(USBTX,USBRX); main() { eth.init(); // enable DHCP eth.connect(); // connect and get address printf("IP address: %s\r\n",eth.getIPAddress()); // print IP address while (1) { } }
I do believe in the earlier models of the ArchPro that they all had the same MAC address, which could confuse the DHCP server (as I understand) if there is more than one ArchPro on the network.
posted by Gary Z 08 Mar 2015