How does the transport layer tell the difference between different data segments?
In order to tell the difference between different data segments the transport layer assigns an identifier to an application. The TCP/IP protocols call this identifier a port number. Each software process that needs to access the network is assigned a port number unique to that host. This port number is used in the transport layer header to indicate to which application that piece of data is associated.
Hope this helps!!!