Non-blocking example of the LWIPInterface
Dependencies: LWIPInterface NetworkSocketAPI mbed-rtos mbed
Non-blocking example for the NetworkSocketAPI. Attempts to get the device's public facing IP address from ifcfg.me using the Happy Eyeballs algorithm to fetch an IPv4 or IPv6 address.
Diff: main.cpp
- Revision:
- 18:a5830a6d3e11
- Parent:
- 17:72de842c27b4
- Child:
- 19:03f1da306347
--- a/main.cpp Tue Jul 21 19:56:29 2015 +0000 +++ b/main.cpp Tue Jul 21 20:20:45 2015 +0000 @@ -28,10 +28,12 @@ wifi.init(); wifi.connect("Buffalo-G-1280", "13808136"); - //char* ip; - //ip = wifi.getIPAddress(); - //if(!(ip==NULL)) - //printf("IP Address is: %s",ip); + char* ip; + ip = wifi.getIPAddress(); + if(ip!=NULL) + printf("IP Address is: %s",ip); + else + printf("No IP"); SocketInterface* mySocket = wifi.allocateSocket(SOCK_TCP);