sandbox / ESP8266Interface

Dependencies:   ESP8266

Fork of ESP8266Interface by Christopher Haster

Files at this revision

API Documentation at this revision

Comitter:
sarahmarshy
Date:
Wed Aug 05 21:58:22 2015 +0000
Parent:
26:6e36dd3cec3f
Child:
28:6426873b21bd
Commit message:
DNS support revised. Timeouts set properly.

Changed in this revision

DnsQuery.lib Show diff for this revision Revisions of this file
ESP8266.lib Show annotated file Show diff for this revision Revisions of this file
ESP8266Interface.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DnsQuery.lib	Mon Jul 27 15:25:53 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/users/sarahmarshy/code/DnsQuery/#5d978992a518
--- a/ESP8266.lib	Mon Jul 27 15:25:53 2015 +0000
+++ b/ESP8266.lib	Wed Aug 05 21:58:22 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/NetworkSocketAPI/code/ESP8266/#2c5afb36bc8c
+http://developer.mbed.org/teams/NetworkSocketAPI/code/ESP8266/#4c014a7f0c63
--- a/ESP8266Interface.cpp	Mon Jul 27 15:25:53 2015 +0000
+++ b/ESP8266Interface.cpp	Wed Aug 05 21:58:22 2015 +0000
@@ -143,14 +143,11 @@
 void ESP8266Interface::getHostByName(const char *name, char* hostIP)
 {
     SocketInterface* sock = this->allocateSocket(SOCK_UDP);
-    IPADDRESS_t ip;
+    
     DnsQuery dns(sock);
-    dns.gethostbyname(name, ip);
-    sock->close();
+    printf("DNS look up starting\n");
+    dns.gethostbyname(name, hostIP);
     this->deallocateSocket(sock);
-    char* resolved = ip.string_format();
-    memcpy(hostIP, resolved, strlen(resolved)+1);
-    printf("IP:%s\n",resolved);
 }   
 
 ESP8266Socket::ESP8266Socket(uint32_t handle, ESP8266 &driver, socket_protocol_t type, uint8_t id)
@@ -230,6 +227,7 @@
 
 uint32_t ESP8266Socket::recv(void *data, uint32_t amount, uint32_t timeout_ms)
 {
+    _driver->setTimeout((int)timeout_ms);
     return _driver->recv(data, amount);
 }