Yuji Hosogaya / Mbed 2 deprecated ModbusTCP_Modified

Dependencies:   EthernetNetIf mbed

Revision:
2:53de07fd9705
Parent:
1:e35ceaa8c758
--- a/ModBus/porttcp.cpp	Tue Mar 13 13:12:21 2012 +0000
+++ b/ModBus/porttcp.cpp	Tue Mar 13 13:16:24 2012 +0000
@@ -199,10 +199,6 @@
     BOOL            bOkay = TRUE;
     USHORT          usLength;
     int             iRes;
-    int i;
-    int total=0;
-    int len;
-    char buf[MB_TCP_BUF_SIZE];
     /* Make sure that we can safely process the next read request. If there
      * is an overflow drop the client.
      */
@@ -213,9 +209,9 @@
         return FALSE;
     }
 
-    while (len = pConnectedSock->recv((char *)&aucTCPBuf[usTCPBufPos], MB_TCP_BUF_SIZE-usTCPBufPos) ) {
-        usTCPBufPos+=len;
-        usTCPFrameBytesLeft-=len;
+    while (iRes = pConnectedSock->recv((char *)&aucTCPBuf[usTCPBufPos], MB_TCP_BUF_SIZE-usTCPBufPos) ) {
+        usTCPBufPos+=iRes;
+        usTCPFrameBytesLeft-=iRes;
     }
 
     /* If we have received the MBAP header we can analyze it and calculate