如果 TCP 是面向连接的,为什么数据包会遵循不同的路径? [英] If TCP is connection oriented why do packets follow different paths?

查看:22
本文介绍了如果 TCP 是面向连接的,为什么数据包会遵循不同的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,如果必须设计互联网应用程序,我们应该使用面向连接的服务或无连接的服务,但不能同时使用两者.

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 面向连接的服务是 TCP,无连接服务是 UDP,两者都驻留在 Internet 协议栈的传输层.

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 唯一的网络层是 IP,它是一种无连接服务.所以这意味着我们设计的任何应用程序最终都会使用 IP 来传输数据包.

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.

所以我的问题是

如果设计了面向连接的应用程序,它应该使用相同的路径传输数据包.但是IP通过使用不同的路由打破了这个规则.那么在这个意义上TCP和IP是如何协同工作的呢?这让我很困惑.

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.

推荐答案

我的朋友,你混淆了两个不同层的功能.

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

TCP 是面向连接的,因为存在连接建立,在两端之间可以协商不同的事情,例如拥塞控制机制等.
传输层协议的一般目的是提供进程到进程的传递,这意味着它对路由一无所知;您的数据包如何到达终端系统超出了他们的范围,他们只关心数据包如何在两个终端进程之间传输.

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 是 Internet 的网络层协议,与端系统之间的数据传输有关,但它是无连接的,它不保持连接,因此每个数据包都独立于其他数据包进行处理.
离开您的系统后,每个路由器都会选择它认为适合每个数据包的路径,此路径可能会根据可用性/拥塞情况而改变.

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.

这如何回答您的问题?
TCP 将确保数据包到达另一个进程,它不会关心它们是如何到达那里的.
另一方面,IP 根本不在乎它们是否到达另一端,它只会根据它认为最适合特定数据包的方式转发每个不同的数据包.

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.

注意:
让我们假设 IP 是面向连接的,这是否意味着数据包将遵循相同的路径?不一定,这取决于该层连接"一词的含义,如果它意味着协商与安全相关的某些选项,例如,您可能仍然通过 Internet 上的不同路由转发所有数据包.


不过不要让您感到困惑,网络层及以下的大多数面向连接的服务意味着,在建立连接时,还会建立所有数据包"必须遵循的虚拟路径,有关更多信息,请阅读:
虚拟电路帧中继网络

这篇关于如果 TCP 是面向连接的,为什么数据包会遵循不同的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆