Dependents:   mtsas

Fork of MTS-Cellular by MultiTech

Revision:
19:f6261f1c3dd4
Parent:
18:fa0d8120f81f
Child:
22:c1004a807490
--- a/Cellular/UIP.cpp	Mon Jun 16 13:50:28 2014 +0000
+++ b/Cellular/UIP.cpp	Tue Jun 17 21:40:53 2014 +0000
@@ -15,7 +15,7 @@
     resetLine = NULL;
     echoMode = true;
     pppConnected = false;
-    mode = TCP;
+    socketMode = TCP;
     socketOpened = false;
     socketCloseable = true;
     local_port = 0;
@@ -187,8 +187,8 @@
     //1) Check that we do not have a live connection up
     if(socketOpened) {
         //Check that the address, port, and mode match
-        if(host_address != address || host_port != port || this->mode != mode) {
-            if(this->mode == TCP) {
+        if(host_address != address || host_port != port || socketMode != mode) {
+            if(socketMode == TCP) {
                 logError("TCP socket already opened [%s:%d]", host_address.c_str(), host_port);
             } else {
                 logError("UDP socket already opened [%s:%d]", host_address.c_str(), host_port);
@@ -277,6 +277,7 @@
     if (response.find("Ok_Info_WaitingForData") != string::npos) {
         logInfo("Opened %s Socket [%s:%d]", sMode.c_str(), address.c_str(), port);
         socketOpened = true;
+        socketMode = mode;
     } else {
         logWarning("Unable to open %s Socket [%s:%d]", sMode.c_str(),  address.c_str(), port);
         socketOpened = false;