Вопрос

I am using sockets in python to send files, and I am doing a packet capture while sending these files. However, I find that each packet is 1434 bytes instead of the 1500 bytes (MTU is set at 1500 bytes on my system).

I have attached some screenshots of the packet capture. I need to send the packet at 1500 bytes rather than the 1434 bytes, can some one tell me what's going on?

packet capture 1 packet capture 2

Это было полезно?

Решение

TCP sends whatever-sized segments it wants to send over the wire; you can't control that from the socket layer. Perhaps the remote machine is only offering a window big enough to send 1314 bytes of data (1314 + 14 bytes of Ethernet header + 20 bytes of IP header without options + 20 bytes of TCP header without options = 1368), or perhaps the congestion window isn't open wide enough to send more data.

Furthermore, you shouldn't have to control that. TCP provides a sequenced byte stream; packet boundaries are NOT significant in TCP!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top