Current location - Loan Platform Complete Network - Big data management - java TCP transfer data there is no size limit, yes, how much, no, why?
java TCP transfer data there is no size limit, yes, how much, no, why?
MTU maximum transmission unit, this maximum transmission unit actually has a close relationship with the link layer protocol, EthernetII frame structure DMAC + SMAC + Type + Data + CRC due to the Ethernet transmission of electrical limitations, each Ethernet frame has a minimum size of 64bytes maximum can not be more than 1518bytes for less than or greater than this limit we can regard this as an error data frame, the general Ethernet forwarding equipment will discard these data frames. Ethernet frames that are smaller or larger than this limit are treated as error frames and are discarded by the Ethernet forwarding device.

Since the maximum data frame size of Ethernet II is 1518Bytes, the header of the Ethernet frame (DMAC destination MAC address 48bit=6Bytes+SMAC source MAC address 48bit=6Bytes+Type field 2bytes) is 14 Bytes and the end of the frame is 4Bytes with CRC checksum. 4Bytes then the rest of the place to carry the upper-layer protocol is the Data domain can only have a maximum of 1500Bytes of this value we call it the MTU.

PPPPoE so-called PPPoE is running on top of the PPP protocol on the Ethernet, some people have wondered, the PPP protocol and the Ethernet are not all link layer protocols? How a link layer to another link layer above to go, is not upgraded into a network layer protocol. In fact, this is a misunderstanding: that is, a certain layer of protocols can only carry a higher layer of protocols.

Why does this strange need arise? This is because with broadband access (this broadband access is usually Cable Modem or xDSL or Ethernet access), because Ethernet lacks authentication and billing mechanisms and the traditional carriers are through the PPP protocol to dial-up and other access services for authentication and billing.

PPPPoE brings benefits and disadvantages, such as: secondary encapsulation consumes resources, reduces transmission performance, etc., these disadvantages I do not say more, the biggest disadvantage is that PPPoE leads to a smaller MTU Ethernet MTU is 1500, and then subtracted from the PPP packet header and footer overhead (8 Bytes), becomes 1492.

UDP packet size should be the size of a UDP packet, so that it can be used as the size of a UDP packet, which is the size of a UDP packet. >The size of the UDP packet would then be 1492 - IP header(20) - UDP header(8) = 1464(BYTES)

The size of the TCP packet would then be 1492 - IP header(20) - TCP header(20) = 1452(BYTES)

The majority of current routing devices have an MTU of 1500

I Understanding of the above is that if we define TCP and UDP packets smaller than 1452, 1464, then our packets don't have to be sub-packetized at the IP layer, so that the transmission avoids errors that occur in grouping packets at the IP layer. If we use UDP protocol, if an error occurs in grouping packets at the IP layer, then the packet is discarded and UDP does not guarantee reliable transmission. But with TCP, when a packet grouping error occurs, the packet is retransmitted and reliable transmission is guaranteed. So, when we program with sockets, the packet size setting does not have to be less than 1400, the UDP protocol requires packets to be less than 64K, TCP has no limit