WIZnet WIZ550io (w5500) support
Dependents: HTTPClient_HelloWorld_WIZ550io NTPClient_HelloWorld_WIZ550io
Fork of WIZ820ioInterface by
Diff: Socket/UDPSocket.cpp
- Revision:
- 9:615198a7b82b
- Parent:
- 5:fb15c35d1e28
--- a/Socket/UDPSocket.cpp Sun Dec 15 12:29:47 2013 +0000 +++ b/Socket/UDPSocket.cpp Mon Dec 23 13:51:35 2013 +0000 @@ -18,6 +18,8 @@ #include "UDPSocket.h" +static int udp_local_port; + UDPSocket::UDPSocket() { } @@ -41,7 +43,12 @@ } } // set local port - eth->sreg<uint16_t>(_sock_fd, Sn_PORT, port); + if (port != 0) { + eth->sreg<uint16_t>(_sock_fd, Sn_PORT, port); + } else { + udp_local_port++; + eth->sreg<uint16_t>(_sock_fd, Sn_PORT, udp_local_port); + } // set udp protocol eth->setProtocol(_sock_fd, UDP); eth->scmd(_sock_fd, OPEN);