modified by ohneta
Dependencies: DnsQuery ESP8266Interface NetworkSocketAPI mbed
Fork of HelloESP8266Interface by
Diff: main.cpp
- Revision:
- 21:979b1db5d7da
- Parent:
- 19:03f1da306347
--- a/main.cpp Wed Jul 22 20:55:47 2015 +0000 +++ b/main.cpp Mon Jul 27 15:18:45 2015 +0000 @@ -31,24 +31,29 @@ char* ip; ip = wifi.getIPAddress(); if(ip!=NULL) - printf("IP Address is: %s",ip); + printf("\nIP Address is: %s\n",ip); else printf("No IP"); - SocketInterface* mySocket = wifi.allocateSocket(SOCK_UDP); + char ip_goog[20]; + wifi.getHostByName("google.com", ip_goog); + printf("Got %s\n",ip_goog); + + /* + SocketInterface* mySocket = wifi.allocateSocket(SOCK_TCP); - mySocket->setAddressPort("192.168.13.6", 7); + mySocket->setAddressPort("192.168.13.5", 7); mySocket->open(); - mySocket->send("Hello",5, 10000); - char recieved[100]; - int recv_amnt = 0; + + mySocket->send("hello",5,10000); + char recieved[6]; recieved[5] = 0; - recv_amnt = mySocket->recv(recieved, 5, 10000); + int recv_amnt = mySocket->recv(recieved, 5, 10000); printf("Recieved: %d, %s\n",recv_amnt,recieved); - mySocket->close(); + */ wifi.disconnect();