Modified version of ModbusTCP

Dependencies:   EthernetNetIf mbed

Files at this revision

API Documentation at this revision

Comitter:
paleskyjp
Date:
Tue Mar 13 13:12:21 2012 +0000
Parent:
0:62be54b8975d
Child:
2:53de07fd9705
Commit message:
Bug fixed on prvMBTCPGetFrame

Changed in this revision

ModBus/porttcp.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ModBus/porttcp.cpp	Tue Mar 13 09:11:49 2012 +0000
+++ b/ModBus/porttcp.cpp	Tue Mar 13 13:12:21 2012 +0000
@@ -213,16 +213,9 @@
         return FALSE;
     }
 
-    /* Though this part is verbose, it doesn't work when data is recieved directly into aucTCPBuf. */
-    while (len = pConnectedSock->recv(&buf[total], MB_TCP_BUF_SIZE-total) ) {
-        total+=len;
-    }
-
-    if(total>0){
-        memcpy((char *)&aucTCPBuf[usTCPBufPos],buf,total);
-        usTCPBufPos+=total;
-        usTCPFrameBytesLeft-=total;
-        prvMBTCPGetFrame();
+    while (len = pConnectedSock->recv((char *)&aucTCPBuf[usTCPBufPos], MB_TCP_BUF_SIZE-usTCPBufPos) ) {
+        usTCPBufPos+=len;
+        usTCPFrameBytesLeft-=len;
     }
 
     /* If we have received the MBAP header we can analyze it and calculate