a library to use GPRS like ethernet or wifi, which makes it possible to connect to the internet with your GPRS module

Dependencies:   BufferedSerial

Dependents:   ThinkSpeak_Test roam_v1 roam_v2 finalv3

Fork of GPRSInterface by wei zou

Revision:
3:acf2ea413e72
Parent:
0:8ccbd963e74d
Child:
4:1142bdd07989
diff -r 8cb3c0d45988 -r acf2ea413e72 Socket/TCPSocketConnection.cpp
--- a/Socket/TCPSocketConnection.cpp	Tue Feb 25 06:00:32 2014 +0000
+++ b/Socket/TCPSocketConnection.cpp	Wed Feb 26 09:12:46 2014 +0000
@@ -22,10 +22,8 @@
 
 #include "TCPSocketConnection.h"
 
-static int size;
 TCPSocketConnection::TCPSocketConnection()
 {
-    size = 0;
 }
 
 int TCPSocketConnection::connect(const char* host, const int port)
@@ -67,6 +65,7 @@
 
 int TCPSocketConnection::receive(char* data, int length)
 {
+#if 0
     if (size < 0) {
         return -1;
     }
@@ -80,7 +79,9 @@
         length = size;
         size = -1;
     }
-    return gprs->recv(_sock_fd, data, length);
+#endif
+    int size = gprs->wait_readable(_sock_fd, DEFAULT_TIMEOUT);
+    return gprs->recv(_sock_fd, data, size);
 }
 
 int TCPSocketConnection::receive_all(char* data, int length)