2
$\begingroup$

It is known that TCP is a connection oriented transport layer protocol of the TCP/IP suite. But TCP (and UDP) operate over a connection less network layer protocol, the IP (internet protocol). What this means is that in TCP, if a sender sends data to the receiver, at the network layer, the receiver will accept the packet, without bothering about the source IP address of the packet. The receiver network layer then strips-off the IP-header from the received packet (and the IP address information of the source and the destination get stripped along with it), and passes off the remaining segment to the transport layer.

Now the doubt arises is, since the IP address information has been stripped away from the packet before forwarding it to the transport layer, how does the TCP sitting at the transport layer manage to decide from which IP address the information has come, when the only address details the transport header contains is the source and destination port numbers of the processes running on the respective hosts?

$\endgroup$
  • $\begingroup$ What is the point in separating network and transport layers and what are responsibilities of each? $\endgroup$ – Maharaj Jun 21 '16 at 12:51
  • $\begingroup$ Network layer facilitates the host-to-host delivery of data, whereas, the transport layer does so for process-to-process delivery. And that exactly is what confuses me, how exactly does TCP go on to implement its connection orientedness? $\endgroup$ – Tanmay Garg Jun 21 '16 at 16:36
1
$\begingroup$

The TCP sitting at the transport layer, doesn't actually have the destination IP address, since the network layer indeed takes that information out before passing it to the transport layer. But to have a proper connection oriented protocol, we include a pseudo-header, which contains the important parts of the IP header, that is, source and destination IP addresses, protocol number and data length. This pseudo header is passed on to the transport layer of the receiver.

Using this pseudo header's fields TCP manages to get the source and destination IP addresses and hence, discard the packets received from the addresses other than the one with which the connection is established.

$\endgroup$
  • $\begingroup$ Thankyou, I could find a lot of relevant information online, using the information provided! :) $\endgroup$ – Tanmay Garg Jun 21 '16 at 17:29
1
$\begingroup$

"Stripped away" is not strictly correct. A TCP packet is an IP header followed by the TCP-specific data. The IP-level information is needed, and used. In particular, the source IP address is needed (as you say) to decide which currently open TCP conversation should receive the packet that has just arrived.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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