I have a question regarding to TCP segments reassembly. I learned the packet could be devided into multiple segments (this is something to do with MSS).
i.e) Message flow (Assumption):
- Client sends a packet that is passed from application layer
- In client side's TCP layer, the packet divided into 3 segments.
- the segments passed to Client's IP layer.
- the Server's IP layer receives the segments.
- In server side's TCP layer, it receives the 3 packets and reassembles it as one packet.
- Server's application layer receives the one packet.
My understaning is that TCP layer is where the divided segments get reassembled. Correct me if I am wrong.
Here is the thing what I really want to clarify.
When using Netty, Server side's "messageReceived()" method gets called only one time or 3 times? If the TCP layer is the place where the divided segments gets reassembled, the "messageReceived()" method gets called only once, correct?
Then, is it really neccesarry to use something like "ReplayingDecoder" to guarantee the number of bytes server is receiving?
Your help is greatly appreciated.
Additional Question:
If the server fails to reassemble the segments because one of them is lost or something, then the TCP layer pass the incomplete packet to the application layer?