Bug 2953 - Application packet Rx size larger than Tx size
Application packet Rx size larger than Tx size
Status: RESOLVED INVALID
Product: ns-3
Classification: Unclassified
Component: applications
ns-3.28
Mac Intel Mac OS
: P3 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-07-15 17:26 UTC by Jonah Ho
Modified: 2018-07-15 17:38 UTC (History)
1 user (show)

See Also:


Attachments
Lena-dual-stripe for reproduction (40.29 KB, text/x-csrc)
2018-07-15 17:31 UTC, Jonah Ho
Details
BulkSendApplication for reproduction (6.90 KB, text/x-csrc)
2018-07-15 17:32 UTC, Jonah Ho
Details
PacketSink for reproduction (6.19 KB, text/x-csrc)
2018-07-15 17:32 UTC, Jonah Ho
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonah Ho 2018-07-15 17:26:00 UTC
Overview:
The packet size created by BulkSendApplication is 512 bytes.  But when received by PacketSink, the packet size is 536 bytes.

Steps to reproduce:
1. Modify bulk-send-application.cc to output packet size upon generating packet.
In BulkSendApplication::SendData, add the line 'std::cout<<"Tx size: "<< packet->GetSize() << "\n";' after creating packet.

2. Modify packet-sink.cc to output packet size upon receive.
In PacketSink::HandleRead, add the line 'std::cout<<"Rx size : "<< packet->GetSize() << "\n";' after receiving packet.

3. Run lena-dual-stripe example located in src/lte/examples with the following settings:
simTime = 10s 
epc = true
epcDl = true
epcUl = false

Actual Results:
Packet size for Tx is 512 bytes and for Rx is 536 bytes

Expected Results:
Same packet size in Tx and Rx
Comment 1 Jonah Ho 2018-07-15 17:27:45 UTC
One more setting to configure. 
useUdp = false
Comment 2 Jonah Ho 2018-07-15 17:31:09 UTC
Created attachment 3139 [details]
Lena-dual-stripe for reproduction
Comment 3 Jonah Ho 2018-07-15 17:32:02 UTC
Created attachment 3140 [details]
BulkSendApplication for reproduction
Comment 4 Jonah Ho 2018-07-15 17:32:25 UTC
Created attachment 3141 [details]
PacketSink for reproduction
Comment 5 Tommaso Pecorella 2018-07-15 17:38:34 UTC
It's normal. TCP does not preserve the packet boundaries, because it's a stream-oriented protocol (unlike UDP).

The TCP packet size is fixed by the TCP Segment Size. You can change it in TcpSocket's Attribute named SegmentSize:

.AddAttribute ("SegmentSize",
               "TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
               UintegerValue (536),
               MakeUintegerAccessor (&TcpSocket::GetSegSize,
                                     &TcpSocket::SetSegSize),
               MakeUintegerChecker<uint32_t> ())