Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ESP8266Interface by
Revision 27:9c6cefc12f0c, committed 2015-04-20
- Comitter:
- michaeljkoster
- Date:
- Mon Apr 20 20:27:11 2015 +0000
- Parent:
- 26:0d5bcb3903e2
- Child:
- 28:91e65e22e63a
- Commit message:
- Blocking
Changed in this revision
Socket/UDPSocket.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Socket/UDPSocket.cpp Tue Dec 30 03:21:33 2014 +0000 +++ b/Socket/UDPSocket.cpp Mon Apr 20 20:27:11 2015 +0000 @@ -68,8 +68,16 @@ int idx = 0; int nb_available = 0; int time = -1; + + //make this the non-blocking case and return if <= 0 + // remember to change the config to blocking + // if ( ! _blocking) { + // if ( wifi.readable <= 0 ) { + // return (wifi.readable); + // } + // } + //--- tmr.start(); - if (_blocking) { while (1) { nb_available = wifi->readable(); @@ -78,6 +86,8 @@ } } } + //--- + // blocking case else { tmr.reset(); @@ -91,7 +101,19 @@ if (nb_available == 0) return nb_available; } + // change this to < 20 mS timeout per byte to detect end of packet gap + // this may not work due to buffering at the UART interface tmr.reset(); + // while ( tmr.read_ms() < 20 ) { + // if ( wifi.readable() && (idx < length) ) { + // buffer[idx++] = wifi->getc(); + // tmr.reset(); + // } + // if ( idx == length ) { + // break; + // } + // } + //--- while (time < _timeout) { nb_available = wifi->readable(); @@ -105,6 +127,7 @@ } time = tmr.read_ms(); } + //--- readEndpoint(remote); return (idx == 0) ? -1 : idx; }