ThingPlug GMMP library for mbed

Dependents:   ThingPlug_WiFi_Example_2 ThingPlug_Ethernet_Example ThingPlug_Ethernet_Example_temp_V2

Fork of GMMP_2 by Sangmin Lee

Files at this revision

API Documentation at this revision

Comitter:
lesmin
Date:
Fri Aug 14 09:11:32 2015 +0000
Parent:
9:68708791efac
Commit message:
added TCP retry codes by WIZnet

Changed in this revision

Network/Network.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 68708791efac -r 84a748b7d1f6 Network/Network.cpp
--- a/Network/Network.cpp	Thu Aug 13 07:09:04 2015 +0000
+++ b/Network/Network.cpp	Fri Aug 14 09:11:32 2015 +0000
@@ -44,14 +44,23 @@
 		return LIB_PARAM_ERROR;
 	}
 
+  int retry = 5;
+  do {
+  	    if (retry <= 0) {
+  	    	ret = SERVER_CONNECT_ERROR;
+  	    	break;
+  	    }
 //  if (client.connect((char *)szServerIp, g_nServerPort)) {
   if (g_pClient->connect((char *)szServerIp, g_nServerPort)) {
     infoln("Connected!!");
+    break;
   } else {
     infoln("connection failed!");
-    ret = SERVER_CONNECT_ERROR;
+//    ret = SERVER_CONNECT_ERROR;
   }
 
+  } while (retry--);
+
 	return ret;
 }