Repository navigation
Sub-optimum packet length #3667
|
I am using the mongoose network stack primarily to run a web server over WiFi on a Raspberry Pico-W, using the mongoose TCP/IP stack, not LWIP. I am using mongoose version 7.2.3. I am using IPv4. When the stack sends an http response, which takes more than one packet, looking on Wireshark, I am still seeing packet sizes less than the max allowed i.e. 1470 vs. 1514. |
Replies: 3 comments
|
Hi @MikeGRobins, This is not an issue, it's intended. To establish the maximum TCP payload size, we factor in the overhead in the worst case scenario. That is when the overhead has the highest possible size. For layer 2 (which is not always a 14-bytes plain Ethernet header) we use the maximum layer 2 header size (40). Same for IPv4 (24 bytes) and TCP, where we use 60 bytes (standard 20 bytes + maximum 40 bytes of options). Therefore, the TCP payload size can be no greater than 1416 bytes. Normally, for an average Ethernet + IPV4 + TCP connection, the overhead is only 54 bytes (14 + 20 + 20). This explains why you see TCP packets with maximum size of 1470. |
|
@MikeGRobins Mike, what are you working on? Is it crucial for you to get max throughput so you care about the TCP frame size? Do you do something like large HTTP downloads or uploads? |
|
Yeap, design choice. Mine, BTW |
Yeap, design choice. Mine, BTW