RC
Dependents: WizFi250_AP_HelloWorld
Fork of WizFi250Interface by
Diff: Socket/UDPSocket.cpp
- Revision:
- 12:bb8e979df6df
- Parent:
- 5:8a0702aa91e3
- Child:
- 17:8c69e246be54
diff -r e52b91d1a5d5 -r bb8e979df6df Socket/UDPSocket.cpp --- a/Socket/UDPSocket.cpp Wed Jun 24 06:25:56 2015 +0000 +++ b/Socket/UDPSocket.cpp Thu Jun 25 05:16:39 2015 +0000 @@ -39,7 +39,7 @@ int UDPSocket::bind(int port) { _port = port; - _server = true; + //_server = true; return 0; } @@ -123,6 +123,14 @@ return -1; } } + else + { + if(!_wizfi250->readable(_cid)) + { + return 0; + } + } + tmr.reset(); time = -1; @@ -136,19 +144,17 @@ } else { - idx += _wizfi250->recv(_cid, &buffer[idx], length - idx); + //idx += _wizfi250->recv(_cid, &buffer[idx], length - idx); + idx += _wizfi250->recvfrom(_cid, &buffer[idx], length - idx, ip, &port); } if (idx == length) break; + time = tmr.read_ms(); } - if (_server) - { - remote.set_address(ip, port); - } - + remote.set_address(ip, port); return (idx==0) ? -1 : idx; }