1. We as the Client to send a message to the Server, the Server will be carried out in response, the other message in two parts: Len (4 bytes), and the Body
2. We only receives Len in channelRead, then will trigger channelReadComplete, leading to can't receive the Body
3. We use tcpdump caught, found that the received data sequence is: Len (4 bytes), FIN, the Body, see figure 1
4. The other party with tcpdump caught, found that send the order is normal: Len (4 bytes), Body, FIN, specific see chart 2
My question is: TCP packet sequence is not a network protocol layer handles? Application level how can appear inconsistent situation? Is a specific setting Netty need? Shouldn't you?
CodePudding user response:
Because our Server side is not development, nor can we adjust the code, otherwise we can contract agreement, so, if you send me order is chaos, isn't that what a? Please give directions, thank you!CodePudding user response:
Is the problem of TCP protocol? Or a Netty issue? Familiar with feel free, please teach, thank you very much!CodePudding user response:
Ever considered the relationship between the byte order, Java is the big end, sending data is big end or a small side,CodePudding user response:
@ Drunkard2000 thank you very much for your reply, according to my understanding (maybe incorrectly) : the big end and small end should only affect a packet data after receiving the correct or not, should not affect the package to send and receive the order confusion? Is that so? Thank you very much!CodePudding user response:
To determine the received Len is correct?TCP is streaming, order should be no problem
Is because the application layer inspection Len<=0, triggering channelReadComplete events
CodePudding user response:
@ Drunkard2000 received Len was right, but because received FIN resulting in Netty automatic trigger channelReadComplete events, the application layer to do Len<=0 (no chance to do), so strange!