Address of a Transport layer?

Solution 1:

How does the transport layer differentiate between different ongoing TCP connections?

TCP differentiates between connections using the IP address & TCP port 4-tuple. In other words, the port number is the transport-layer address.

(Sockets are only a mechanism for applications to request the services of the transport layer – the fact that applications use them doesn't make the whole address "application-layer".)

It seems that OSI does not actually have application-layer addresses at all; it has presentation-layer addresses. As the ITU-T X.650 specification says:

6.2.2.3 […] a presentation-address is used to access an application-entity.

11.1.2.1 In order for an application-entity-invocation to establish an application-association with another application-entity-invocation, it uses the presentation-address of the called application-entity to establish a presentation-connection or to use the presentation connectionless-mode service.

In the same X.650 (section 9.6.1), an OSI presentation-layer address is described as a tuple in the form:

(P-selector, S-selector, T-selector, list of network-addresses)

where T-selector identifies the transport, S-selector identifies the session, and P-selector identifies the presentation service.

But keep in mind that TCP/IP is not OSI. The OSI architecture was meant to describe the OSI protocol stack (e.g. CLNS and TP4) – it was not meant to describe TCP/IP, nor was TCP/IP meant to conform to it. Not all features of the OSI architecture have TCP/IP equivalents.

In particular, the TCP/IP protocol stack does not have an universal equivalent to the OSI session and presentation layers at all, and it does not have unified "presentation addresses" either. The functionality only exists as part of individual application-layer protocols (e.g. it seems to me that TLS ALPN might provide the "P-selector" function).