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

Fork of EthernetInterfaceW5500 by W5500-Ethernet-Interface Makers

Revision:
10:cadac6bcd169
Parent:
5:fb15c35d1e28
Child:
15:fe68ac753657
--- a/Socket/Socket.cpp	Mon Dec 23 13:51:35 2013 +0000
+++ b/Socket/Socket.cpp	Thu Jul 17 07:10:36 2014 +0000
@@ -15,25 +15,31 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
- 
+
 #include "Socket.h"
 
-Socket::Socket() : _sock_fd(-1),_blocking(true), _timeout(1500) {
-    eth = WIZ820io::getInstance();
+Socket::Socket() : _sock_fd(-1),_blocking(true), _timeout(1500)
+{
+    eth = WIZnet_Chip::getInstance();
     if (eth == NULL) {
-        error("Socket constructor error: no WIZ8820io instance available!\r\n");
-    }       
+        error("Socket constructor error: no W5500 instance available!\r\n");
+    }
 }
 
-void Socket::set_blocking(bool blocking, unsigned int timeout) {
+void Socket::set_blocking(bool blocking, unsigned int timeout)
+{
     _blocking = blocking;
     _timeout = timeout;
 }
 
-int Socket::close() {
+int Socket::close()
+{
+    // add this code refer from EthernetInterface.
+    _sock_fd = -1;
     return (eth->close(_sock_fd)) ? 0 : -1;
 }
 
-Socket::~Socket() {
+Socket::~Socket()
+{
     close(); //Don't want to leak
 }