- uint32_t totalBytes = mysocket->TotalBytes;
- while ((mysocket->sentBytes) < totalBytes && localSocket->GetTxAvailable () > 0){
- uint32_t toWrite = min ((mysocket->remaining), writeSize);
- toWrite = min (toWrite, localSocket->GetTxAvailable ());
- int amountSent = localSocket->Send (&data[0], toWrite, 0);
-
-// cout << Simulator::Now () << " AmountSend: " << amountSent << " Towrite: " << toWrite << endl;
- if(amountSent < 0)
- return;
- (mysocket->sentBytes) += amountSent;
+ uint32_t totalBytes = mysocket->totalBytes;
+ while ((mysocket->bufferedBytes) < totalBytes && localSocket->GetTxAvailable () > 0){
+ uint32_t toWrite = min ((mysocket->remaining), writeSize);
+ toWrite = min (toWrite, localSocket->GetTxAvailable ());
+ int amountSent = localSocket->Send (&data[0], toWrite, 0);
+
+ if(amountSent < 0)
+ return;
+
+ (mysocket->last_amount_sent) += amountSent;
+ (mysocket->bufferedBytes) += amountSent;