TCP packet size #7640
-
Hello, What is the maximum size for each packet sent via TCP? From the code, the maximum size of the TCP receive buffer is OT_TCP_RECEIVE_BUFFER_SIZE_FEW_HOPS = 2599, but each packet is broken down on average around 462 bytes. However, sometimes it goes over that (e.g., 715 byte packet), so I'm just wondering where the max TCP packet size is defined. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @kmfnjtze8888, thanks for your interest in TCP. The maximum segment size is defined at https://github.com/openthread/openthread/blob/main/third_party/tcplp/bsdtcp/tcp_const.h#L54. It is calculated assuming a target of 5 frames per TCP segment (that's why If you wish to tune this value, I would recommend first reading Section 6.1 of the TCPlp paper, which explains how the current MSS of 5 frames was chosen. In high-interference environments, it may make sense to reduce the MSS to 3 frames, which can be done by setting The TCP implementation may deliver data to the application in odd-sized chunks on occasion, due to multiple data-containing TCP segments being received before the application reads the data. Could this be what you observed with 715-byte packets? The actual data-containing TCP segments sent over the air should never be that big. |
Beta Was this translation helpful? Give feedback.
Hi @kmfnjtze8888, thanks for your interest in TCP.
The maximum segment size is defined at https://github.com/openthread/openthread/blob/main/third_party/tcplp/bsdtcp/tcp_const.h#L54. It is calculated assuming a target of 5 frames per TCP segment (that's why
FRAMECAP_6LOWPAN
is set to5
). In that code,MSS_6LOWPAN
is set to474
; the actual amount of data in each outgoing packet comes out to 462 bytes because 12 bytes are lost due to the TCP timestamp option.If you wish to tune this value, I would recommend first reading Section 6.1 of the TCPlp paper, which explains how the current MSS of 5 frames was chosen. In high-interference environments, it may make sense to reduce the MSS to 3 fram…