为什么说TCP/IP协议族中的IP协议是无连接的?
为什么IP被称为无连接协议?如果是的话,那么面向连接的协议是什么?
谢谢。
更新 - 1 - 20:21 2010/12/26
我认为,为了更好地回答我的问题,最好从物理上和逻辑上解释“连接”的实际含义。
更新 - 2 - 9:59 AM 2/1/2013
基于以下所有答案,我觉得这里提到的“连接”应该被视为一组行动/安排/纪律。因此,它更多的是一个抽象的概念,而不是一个具体的对象。
更新 - 3 - 11:35 AM 6/18/2015
这里有一个更物理的解释:
IP 协议是无连接的,因为 IP 网络中的所有数据包都是独立路由的,它们不一定经过相同的路由,而在一个网络中虚电路网络是面向连接的,所有数据包都经过相同的路由。这种单一路由就是“虚拟电路”的含义。
使用连接时,因为只有 1 条路由,所以所有数据包将按照发送出去的顺序到达。
没有连接,不保证所有数据包都能到达 按照发送的顺序。
更新 - 4 - 9:55 AM 2016/1/20/Wed
面向连接的特征之一是保留数据包顺序。 TCP 使用序列号来实现这一点,但 IP 没有这样的设施。因此,TCP 是面向连接的,而 IP 是无连接的。
Why is the IP called a connectionless protocol? If so, what is the connection-oriented protocol then?
Thanks.
Update - 1 - 20:21 2010/12/26
I think, to better answer my question, it would be better to explain what "connection" actually means, both physically and logically.
Update - 2 - 9:59 AM 2/1/2013
Based on all the answers below, I come to the feeling that the 'connection' mentioned here should be considered as a set of actions/arrangements/disciplines. Thus it's more an abstract concept rather than a concrete object.
Update - 3 - 11:35 AM 6/18/2015
Here's a more physical explanation:
IP protocol is connectionless in that all packets in IP network are routed independently, they may not necessarily go through the same route, while in a virtual circuit network which is connection oriented, all packets go through the same route. This single route is what 'virtual circuit' means.
With connection, because there's only 1 route, all data packets will arrive in the same order as they are sent out.
Without connection, it is not guaranteed all data packets will arrive
in the same order as they are sent out.
Update - 4 - 9:55 AM 2016/1/20/Wed
One of the characteristics of connection-oriented
is that the packet order is preserved. TCP use a sequence number to achieve that but IP has no such facility. Thus TCP is connection-oriented while IP is connection-less.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
基本思想非常简单:使用 IP(就其本身而言——没有 TCP、UDP 等),您只是发送一个数据包。您只需将一些带有目标地址的数据发送到网络上,仅此而已。就其本身而言,IP 给出:
它所做的只是指定一个最小的数据包格式,以便您可以获得一些数据从一个点到另一个点(例如,路由器知道数据包格式,因此它们可以查看目的地并在其下一跳上发送数据包)。
TCP是面向连接的。建立连接意味着在 TCP 会话开始时,它会进行“三次握手”,以便(特别是)目的地知道与源的连接已建立。它在内部跟踪该地址,因此它可以/将会/确实期望来自该地址的更多数据包,并且能够发送回复以(例如)确认它收到的每个数据包。源和目的地还合作对所有数据包进行序列号以用于确认方案,因此每一端都知道另一端是否收到了它发送的数据包。这在物理上并不涉及太多,但在逻辑上它涉及在两端分配一些内存。这包括元数据的内存,例如要使用的下一个数据包序列号,以及可能重新传输的有效负载数据,直到另一方确认收到该数据包。
The basic idea is pretty simple: with IP (on its own -- no TCP, UDP, etc.) you're just sending a packet of data. You simply send some data onto the net with a destination address, but that's it. By itself, IP gives:
All it does is specify a minimal packet format so you can get some data from one point to another (e.g., routers know the packet format, so they can look at the destination and send the packet on its next hop).
TCP is connection oriented. Establishing a connection means that at the beginning of a TCP conversation, it does a "three way handshake" so (in particular) the destination knows that a connection with the source has been established. It keeps track of that address internally, so it can/will/does expect more packets from it, and be able to send replies to (for example) acknowledge each packet it receives. The source and destination also cooperate to serial number all the packets for the acknowledgment scheme, so each end knows whether packets it sent were received at the other end. This doesn't involve much physically, but logically it involves allocating some memory on both ends. That includes memory for metadata like the next packet serial number to use, as well as payload data for possible re-transmission until the other side acknowledges receipt of that packet.
TCP/IP 的意思是“基于 IP 的 TCP”。
注意:
编辑:
“面向连接”表示已建立的端到端连接。例如,你拿起电话,给某人打电话=你建立了连接。
“无连接”意味着“发送它,看看会发生什么”。例如,通过蜗牛邮件发送一封信。a
因此,IP 可能以任何顺序将数据包从 A 发送到 B,但最终并不总是如此。 TCP 将它们分类、确认、请求重新发送并提供“连接”
TCP/IP means "TCP over IP".
Notes:
Edit:
"connection-oriented" mean established end to end connection. For example, you pick up the telephone, call someone = you have a connection.
"connection-less" means "send it, see what happens". For example, sending a letter via snail mail.a
So IP gets your packets from A to B, maybe, in any order, not always eventually. TCP sorts them out, acknowledges them, requests a resends and provides the "connection"
无连接意味着不努力建立专用的端到端连接,而面向连接意味着当设备通信时,它们执行握手来建立端到端连接。
IP 是无连接协议的一个示例,在这种协议中,您通常从源到目的地单向发送信息,而不检查目的地是否仍然存在,或者是否准备好接收信息。
无连接协议(如 IP 和 UDP)用于视频会议,当您不关心某些数据包是否丢失时,而当您发送文件时必须使用面向连接的协议(如 TCP)因为你要确保所有数据包都发送成功(实际上我们使用FTP来传输文件)。
编辑 :
Connectionless means that no effort is made to set up a dedicated end-to-end connection, While Connection-Oriented means that when devices communicate, they perform handshaking to set up an end-to-end connection.
IP is an example of the Connectionless protocols , in this kind of protocols you usually send informations in one direction, from source to destination without checking to see if the destination is still there, or if it is prepared to receive the information .
Connectionless protocols (Like IP and UDP) are used for example with the Video Conferencing when you don't care if some packets are lost , while you have to use a Connection-Oriented protocol (Like TCP) when you send a File because you want to insure that all the packets are sent successfully (actually we use FTP to transfer Files).
Edit :
TCP是TCP/IP的连接部分。 IP是寻址。
或者打个比方,IP 是写在信封上的地址,TCP 是邮政系统,它使用该地址作为将信封从 A 点发送到 B 点的工作的一部分。
TCP is the connection part of TCP/IP. IP's the addressing.
Or, as an analogy, IP is the address written on the envelope, TCP is the postal system which uses the address as part of the work of getting the envelope from point A to point B.
当两台主机想要使用面向连接的协议进行通信时,其中一台必须首先发起连接,另一台必须接受该连接。从逻辑上讲,在一台主机的端口与另一台主机的其他端口之间建立连接。一台主机中的软件必须执行连接套接字操作,而另一台主机中的软件必须执行接受套接字操作。物理上,发起方主机发送一个 SYN 数据包,其中包含所有四个连接标识号(源 IP、源端口、目标 IP、目标端口)。对方收到后发送SYN-ACK,发起方发送ACK,连接建立。连接建立后,就可以双向传输数据。
另一方面,无连接协议意味着我们不需要建立连接来发送数据。这意味着从一个主机发送到另一个主机的第一个数据包可能包含数据有效负载。当然对于UDP等上层协议,接收方必须首先准备好,(例如)它必须执行监听udp套接字操作。
When two hosts want to communicate using connection oriented protocol, one of them must first initiate a connection and the other must accept it. Logically a connection is made between a port in one host and other port in the other host. Software in one host must perform a connect socket operation, and the other must perform an accept socket operation. Physically the initiator host sends a SYN packet, which contains all four connection identifying numbers (source IP, source port, destination IP, destination port). The other receives it and sends SYN-ACK, the initiator sends an ACK, then the connection are established. After the connection established, then the data could be transferred, in both directions.
In the other hand, connectionless protocol means that we don't need to establish connection to send data. It means the first packet being sent from one host to another could contain data payloads. Of course for upper layer protocols such as UDP, the recipient must be ready first, (e.g.) it must perform a listen udp socket operation.
据我所知,每一层都会愚弄它上面的一层。 TCP 从应用层获取 HTTP 消息并将其分解为数据包。我们称它们为数据包。 IP从TCP中一一获取这些数据包,并将其扔向目的地;此外,它还收集传入数据包并将其传递给 TCP。现在,TCP发送数据包后,等待对方的确认数据包。如果它来了,它就说上面一层,嘿,我已经建立了连接,现在我们可以通信了!整个通信过程是在双方的TCP层之间进行的,相互发送和接收不同类型的数据包(例如数据包、确认包、同步包、blah blah包)。它使用其他技巧(所有数据包发送)来确保实际数据包在分解和组装时按顺序传送。组装后,将它们传输到上面的应用层。那个傻瓜认为它在已建立的连接中收到了 HTTP 消息,但实际上,只是在传输数据包。
In my knowledge, every layer makes a fool of the one above it. The TCP gets an HTTP message from the Application layer and breaks it into packets. Lets call them data packets. The IP gets these packets one by one from TCP and throws it towards the destination; also, it collects an incoming packet and delivers it to TCP. Now, TCP after sending a packet, waits for an acknowledgement packet from the other side. If it comes, it says the above layer, hey, I have established a connection and now we can communicate! The whole communication process goes on between the TCP layers on both the sides sending and receiving different types of packets with each other (such as data packet, acknowledgement packet, synchronization packet , blah blah packet). It uses other tricks (all packet sending) to ensure the actual data packets to be delivered in ordered as they were broken and assembled. After assembling, it transfers them to the above application layer. That fool thinks that it has got an HTTP message in an established connection but in reality, just packets are being transferred.
我今天刚刚遇到这个问题。这句话整天在我脑子里转来转去,没有任何意义。 IP 不处理传输。为什么有人会认为 IP 是无连接的或面向连接的?从技术上讲,它是无连接的,因为它不提供可靠性,也不保证交付。但我的烤面包机也是如此。我的烤面包机不提供交货保证,那么为什么不将烤面包机也称为无连接呢?
最后,我发现这只是一些愚蠢的标题,有人在某个地方附加到IP上并且它被卡住了,现在每个人都称IP无连接并且没有充分的理由。
称IP为无连接意味着还有另一个面向连接的第3层协议,但据我所知,并不存在,而且指定IP是无连接的简直是愚蠢的。 MAC 是无连接的。 LLC 是无连接的。但这是无用的、技术上正确的信息。
I just came across this question today. It was bouncing around in my head all day and didn't make any sense. IP doesn't handle transport. Why would anyone even think of IP as connectionless or connection oriented? It is technically connectionless because it offers no reliability, no guaranteed delivery. But so is my toaster. My toaster offers no guaranteed delivery, so why not call aa toaster connectionless too?
In the end, I found out it's just some stupid title that someone somewhere attached to IP and it stuck, and now everyone calls IP connectionless and has no good reason for it.
Calling IP connectionless implies there is another layer 3 protocol that is connection oriented, but as far as I know, there isn't and it is just plain stupid to specify that IP is connectionless. MAC is connectionless. LLC is connectionless. But that is useless, technically correct info.