2

My understanding is that a tcp socket is uniquely identified by the tuple src ip:port and dst ip:port.

Imagine I have a simple client/server application where the client can send some data request message and the server responds uniquely to that request over one single tcp socket.

Say the client asynchronously fires off a bunch of requests in a row before the server can respond to any of them. The client then receives a bunch of responses back some time later; one for each request.

Is there some kind of mechanism in the tcp/ip stack that lets you relate one packet with another, aka the request and the response? Is the identification task the responsibility of the protocol in the data payload itself? Or is this just not how TCP works at all?

1
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Commented Aug 12, 2017 at 5:30

2 Answers 2

1

TCP/IP will reassemble a TCP segment that was broken into IP packets. Reassembling other datagrams from the individual TCP segments is left to the upper layer protocols.

1

TCP will not just blindly send a bunch of requests to a server; besides the initial three way hand shake, there are some flow control mechanisms in place.

Given a scenario where a connection is established and the client sends data to the server, the servers response will include sequence numbers so that the client can put the data back together before handing to the application.

1
  • Thanks for pointing me towards seq and ack numbers. I'll look into this further.
    – anders
    Commented Sep 2, 2015 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.