PacketSink::GetTotalRx() does not match with the number of bytes sent by TCP over a lossy channel

111 views
Skip to first unread message

Ye Li

unread,
Jun 8, 2019, 11:56:34 AM6/8/19
to ns-3-users
Hi all,

I'm trying to send a given number of bytes via TCP over a lossy link. I borrowed tutorial/fifth.cc, and modified it to use RateErrorModel::ERROR_UNIT_PACKET. See the modified script as baseline-tcp.cc attached. The simulation sends 200 packets of size 1200 bytes (i.e., 240,000 bytes) over a link of 0.1 rate of packet loss. However, GetTotalRx() of PacketSink shows that only 144,000 bytes are received. I also verified using the Rx trace of PacketSink. Summing up the sizes of received Packet, the number is still 144,000. Even more oddly, even if I set the ErrorRate to 0.0, I still cannot get 240,000 bytes. What I got is 158,400 with the attached script.

I then tried the examples/tcp/tcp-bulk-send.cc, and also add the RateErrorModel. The modified script is attached as lossy-tcp-bulk-send.cc. Again, I cannot get 240,000 by running 

    ./waf --run "lossy-tcp-bulk-send --maxBytes=240000"

if I set the ErrorRate to 0.1. However, I can get 240,000 if I set ErrorRate to 0.0 with script.

The results confuse me. I thought TCP is a reliable protocol, and therefore introducing the ErrorModel would only affect the completion time and Cwnd sizes. Maybe I had a misunderstanding of the RateErrorModel or other parts in NS-3 or the scripts were not correct? Can anyone please help figure this out? Thanks a lot.

Best Regards
baseline-tcp.cc
lossy-tcp-bulk-send.cc

Ye Li

unread,
Jun 8, 2019, 9:20:44 PM6/8/19
to ns-3-users
Update:

After extending the simulation time in lossy-tcp-bulk-send.cc, I was able to receive exactly the same number of bytes as I sent, using TCP via RateErrorModel with ERROR_UNIT_PACKET. 

However, I still don't know why baseline-tcp.cc doesn't work as expected.
Reply all
Reply to author
Forward
0 new messages