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

Fork of EthernetInterfaceW5500 by W5500-Ethernet-Interface Makers

Files at this revision

API Documentation at this revision

Comitter:
ppo
Date:
Fri Aug 29 12:00:38 2014 +0000
Parent:
14:a089e591e530
Commit message:
bug fixed in close(), now socket is really closed

Changed in this revision

Socket/Socket.cpp Show annotated file Show diff for this revision Revisions of this file
Socket/TCPSocketServer.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Socket/Socket.cpp	Tue Aug 19 23:32:48 2014 +0000
+++ b/Socket/Socket.cpp	Fri Aug 29 12:00:38 2014 +0000
@@ -35,8 +35,10 @@
 int Socket::close()
 {
     // add this code refer from EthernetInterface.
+    int res;
+    res = eth->close(_sock_fd);
     _sock_fd = -1;
-    return (eth->close(_sock_fd)) ? 0 : -1;
+    return (res)? 0: -1;
 }
 
 Socket::~Socket()
--- a/Socket/TCPSocketServer.cpp	Tue Aug 19 23:32:48 2014 +0000
+++ b/Socket/TCPSocketServer.cpp	Fri Aug 29 12:00:38 2014 +0000
@@ -81,12 +81,15 @@
     // and then, for the next connection, server socket should be assigned new one.
     _sock_fd = -1; // want to assign new available _sock_fd.
     if(bind(listen_port) < 0) {
-        error("No more socket for listening");
+        error("No more socket for listening, bind error");
+        return -1;
     } else {
         //return -1;
         if(listen(1) < 0) {
-            error("No more socket for listening");
+            error("No more socket for listening, listen error");
+            return -1;
         }
+        
     }
     return 0;
 }