Wolfgang
Wolfgang

Reputation: 91

Handling of TCP packet order on receiver side on application level

by TCP socket programming: on my application, receiver side uses a small size buffer then transmitted data. So recv() is called several times til all data is received. On each call of recv(), used buffer is copied to another big buffer or appending to a file partly.

My question here is, should I handle the received TCP "packet order" in my code additionally, or TCP handles it on its own buffer on the background? Because transmitted TCP packets arrive to the receiver side not in a correct order.

Upvotes: 0

Views: 350

Answers (1)

Prabhu
Prabhu

Reputation: 3541

My question here is, should I handle the received TCP "packet order" in my code additionally

No. TCP guarantees that it will handover the data to the application in the order it is received. Application need not implement the logic to ensure the order of data reception. Review your application code again for any bugs which is resulting in the received data being not in the same order it was sent.

Upvotes: 1

Related Questions