Ethernet interface for W5500 with bug fixed in socket::close()

Fork of EthernetInterfaceW5500 by W5500-Ethernet-Interface Makers

Revision:
10:cadac6bcd169
Parent:
9:615198a7b82b
--- a/Socket/UDPSocket.cpp	Mon Dec 23 13:51:35 2013 +0000
+++ b/Socket/UDPSocket.cpp	Thu Jul 17 07:10:36 2014 +0000
@@ -23,13 +23,13 @@
 UDPSocket::UDPSocket()
 {
 }
-
+// After init function, bind() should be called.
 int UDPSocket::init(void)
 {
     if (_sock_fd < 0) {
         _sock_fd = eth->new_socket();
     }
-    eth->setProtocol(_sock_fd, UDP);
+    if (eth->setProtocol(_sock_fd, UDP) == false) return -1;
     return 0;
 }
 
@@ -77,7 +77,7 @@
     }
     eth->recv(_sock_fd, (char*)info, sizeof(info));
     readEndpoint(remote, info);
-    int udp_size = info[6]<<8|info[7]; 
+    int udp_size = info[6]<<8|info[7];
     //TEST_ASSERT(udp_size <= (size-sizeof(info)));
     if (udp_size > (size-sizeof(info))) {
         return -1;