Answer the question
In order to leave comments, you need to log in
How is data divided into TCP segments?
How is data divided into TCP segments?
If we pass a large array of text over HTTP in UTF8 encoding, can it happen that the segment separation will go through some character?
(That is, the first byte of the character will be in the first segment, and the subsequent ones in the second?)
Answer the question
In order to leave comments, you need to log in
in case of double byte unicode/utf characters? Of course, it can, for any offset, it can share. Therefore, the \r\n separator is used in the http headers, and an explicit size is indicated for the body, so that the receiving side knows for sure that not the entire http request has been accepted yet and needs to be accepted further, and not to start parsing
...and nothing bad will happen. We read about the seven-level model . Each level sends the volume it can send. TCP fragments into its units, IP into its own, Ethernet into its own. When receiving, they are also collected accordingly and at the last level - HTTP is given a completely transferred array.
the TCP control system will do everything itself: it will cut the input stream of bytes into packets and fully assemble everything back in the correct sequence, for this it was created. How the sawing will be done, the user is not told how many places there are in the MTU so many are sent :)
you will not see the links between the packets, because these are not the user's problems, but the data transmission control systems and they have all been thought out for a long time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question