GSwifiInterface library (interface for GainSpan Wi-Fi GS1011 modules) Please see https://mbed.org/users/gsfan/notebook/GSwifiInterface/
Dependents: GSwifiInterface_HelloWorld GSwifiInterface_HelloServo GSwifiInterface_UDPEchoServer GSwifiInterface_UDPEchoClient ... more
Fork of WiflyInterface by
GainSpan Wi-Fi library
The GS1011/GS2100 is an ultra low power 802.11b wireless module from GainSpan.
mbed RTOS supported.
- about this library: http://mbed.org/users/gsfan/notebook/GSwifiInterface/
- about Wi-Fi module: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
ゲインスパン Wi-Fi モジュール ライブラリ
ゲインスパン社の低電力 Wi-Fiモジュール(無線LAN) GS1011/GS2100 シリーズ用のライブラリです。
mbed RTOS に対応しています。(mbed2.0)
- このライブラリについて: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
- Wi-FIモジュールについて: http://mbed.org/users/gsfan/notebook/gainspan_wifi/
- UARTコマンド、SPIデータインターフェースに対応しました。(2019/09)
Diff: Socket/UDPSocket.cpp
- Revision:
- 22:d25a5a0d2497
- Parent:
- 12:057089026a20
diff -r 6431364fc667 -r d25a5a0d2497 Socket/UDPSocket.cpp --- a/Socket/UDPSocket.cpp Thu Jun 05 06:12:59 2014 +0000 +++ b/Socket/UDPSocket.cpp Tue Sep 24 06:24:37 2019 +0000 @@ -40,6 +40,13 @@ { _port = port; _server = true; + + if (_cid < 0 && _wifi->isAssociated()) { + // Socket open + _cid = _wifi->listen(GSwifi::PROTO_UDP, _port); + if (_cid < 0) return -1; + } + return 0; } @@ -103,10 +110,11 @@ if (_wifi->readable(_cid)) { break; } + Thread::wait(1); time = tmr.read_ms(); } if (time >= _timeout + 20) { - return -1; + return 0; } } @@ -126,7 +134,7 @@ return -1; } - if (idx == length) { + if (idx == length || idx > 0) { break; } @@ -136,5 +144,6 @@ if (_server) { remote.set_address(ip, port); } - return (idx == 0) ? -1 : idx; +// return (idx == 0) ? -1 : idx; + return idx; }