Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If TCP is connection oriented why do packets follow different paths?

According to my knowledge if an internet application has to be designed, we should use either a connection-oriented service or connection-less service, but not both.

Internet's connection oriented service is TCP and connection-less service is UDP, and both resides in the transport layer of Internet Protocol stack.

Internet's only network layer is IP, which is a connection-less service. So it means whatever application we design it eventually uses IP to transmit the packets.

Connection-oriented services use the same path to transmit all the packets, and connection-less does not.

Therefore my problem is

if a connection oriented application has been designed, it should transmit the packets using the same path. But IP breaks that rule by using different routes.So how do both TCP and IP work together in this sense? It totally confuses me.

like image 863
Assasins Avatar asked Mar 24 '13 17:03

Assasins


People also ask

Why do packets take different paths?

Each router examines and sends each IP packet individually — this is called packet switching. If the network changes, due to congestion or faults, routers can use an alternative interfaces to reach a destination. So packets may travel over different routes to reach the same destination.

Do TCP packets follow the same route?

Connection-oriented services use the same path to transmit all the packets, and connection-less does not. if a connection oriented application has been designed, it should transmit the packets using the same path.

Do all packets follow the same route to their destination?

Each packet does not follow the same route. It does not store and forward transmission. It does store and forward transmission. Initially designed for Voice communication.

Can packets take different paths?

It also means that packets can take different network paths to the same destination, so long as they all arrive at the destination. (In certain protocols, packets do need to arrive at their final destinations in the correct order, even if each packet took a different route to get there.)


1 Answers

You, my friend, are confusing the functionality of two different layers.

TCP is connection oriented in the sense that there's a connection establishment, between the two ends where they may negotiate different things like congestion-control mechanism among other things.
The transport layer protocols' general purpose is to provide process-to-process delivery meaning that it doesn't know anything about routes; how your packets reach the end system is beyond their scope, they're only concerned with how packets are being transmitted between the two end PROCESSES.

IP, on the other hand, the Network layer protocol for the Internet, is concerned with data-delivery between end-systems yet it's connection-less, it maintains no connection so each packet is handled independently of the other packets.
Leaving your system, each router will choose the path that it sees fit for EACH packet, and this path may change depending on availability/congestion.

How does that answer your question?
TCP will make sure packets reach the other process, it won't care HOW they got there.
IP, on the other hand, will not care if they reach the other end at all, it'll simply forward each different packet according to what it sees most fit for a particular packet.

Note:
Let's assume that IP was connection-oriented, would that mean packets would follow the same-path? Not necessarily, it depends on what the word 'connection' at this layer means, if it means negotiating certain options related to security, for instance, you may still have all your packets being forwarded through different routes over the Internet.

EDIT:
Not to confuse you though, most connection-oriented services at the network-layer and below mean that the connection, when established, also establishes a virtual-path that all 'packets' must follow, for further information read about:
Virtual circuit and frame-relay networks

like image 180
Fingolfin Avatar answered Oct 04 '22 16:10

Fingolfin