ThingPlug GMMP library for mbed
Dependents: ThingPlug_WiFi_Example_2 ThingPlug_Ethernet_Example ThingPlug_Ethernet_Example_temp_V2
Fork of GMMP_2 by
Diff: Network/Network.cpp
- Revision:
- 10:84a748b7d1f6
- Parent:
- 0:7e575e5f88ec
--- 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; }