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?