Use the correct semantics for sendcallback
authorRaj Bhattacharjea <raj.b@gatech.edu>
Mon, 12 May 2008 15:12:26 -0400
changeset 3241 284705f0775f
parent 3240 965da7165e78
child 3242 309f511aa143
Use the correct semantics for sendcallback
examples/tcp-large-transfer.cc
--- a/examples/tcp-large-transfer.cc	Mon May 12 13:27:45 2008 -0400
+++ b/examples/tcp-large-transfer.cc	Mon May 12 15:12:26 2008 -0400
@@ -206,7 +206,12 @@
       char m = toascii (97 + i % 26);
       data[i] = m;
     }
-    localSocket->Send (data, curSize);
+    uint32_t amountSent = localSocket->Send (data, curSize);
+    if(amountSent < curSize)
+      {
+        std::cout << "Socket blocking, returning" << std::endl;
+        return;
+      }
     nBytes -= curSize;
   }
 }