for testing wifi

Dependents:   ESP8266_Test_WIFI

Fork of ESP8266Interface by Steve Kim

Revision:
22:c4360e61486a
Parent:
21:690526f05fe6
Child:
23:de9221771e96
--- a/Socket/UDPSocket.cpp	Tue Dec 02 04:16:26 2014 +0000
+++ b/Socket/UDPSocket.cpp	Tue Dec 02 16:02:21 2014 +0000
@@ -68,7 +68,8 @@
     int idx = 0;
     int nb_available = 0;
     int time = -1;
-
+    tmr.start();
+    
     if (_blocking) {
         while (1) {
             nb_available = wifi->readable();
@@ -78,7 +79,7 @@
         }
     }
     else {
-        tmr.start();
+        tmr.reset();
         
         while (time < _timeout){
             nb_available = wifi->readable();
@@ -90,8 +91,7 @@
         if (nb_available == 0) return nb_available;  
     } 
     
-    tmr.start();
-
+    tmr.reset();
     while (time < _timeout) {
 
         nb_available = wifi->readable();
@@ -106,7 +106,6 @@
         
         time = tmr.read_ms();
     }
-
     readEndpoint(remote);
     return (idx == 0) ? -1 : idx;
 }