TCP与UDP的区别
来源:互联网 发布:linux yum命令有什么用 编辑:程序博客网 时间:2024/05/01 18:48
Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)
Difference between TCP and UDP
TCPUDPReliability: TCP is connection-oriented protocol. When a file or message send it will get delivered unless connections fails. If connection lost, the server will request the lost part. There is no corruption while transferring a message.Reliability: UDP is connectionless protocol. When you a send a data or message, you don't know if it'll get there, it could get lost on the way. There may be corruption while transferring a message.Ordered: If you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order.Ordered: If you send two messages out, you don't know what order they'll arrive in i.e. no orderedHeavyweight: - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together.Lightweight: No ordering of messages, no tracking connections, etc. It's just fire and forget! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.Streaming: Data is read as a "stream," with nothing distinguishing where one packet ends and another begins. There may be multiple packets per read call.Datagrams: Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call.Examples: World Wide Web (Apache TCP port 80), e-mail (SMTP TCP port 25 Postfix MTA), File Transfer Protocol (FTP port 21) and Secure Shell (OpenSSH port 22) etc.Examples: Domain Name System (DNS UDP port 53), streaming media applications such as IPTV or movies, Voice over IP (VoIP), Trivial File Transfer Protocol (TFTP) and online multiplayer games etcTo establish a connection, TCP uses a three-way handshake. Before a client attempts to connect with a server, the server must first bind to and listen at a port to open it up for connections: this is called a passive open. Once the passive open is established, a client may initiate an active open. To establish a connection, the three-way (or 3-step) handshake occurs:
- SYN: The active open is performed by the client sending a SYN to the server. The client sets the segment's sequence number to a random value A.
- SYN-ACK: In response, the server replies with a SYN-ACK. The acknowledgment number is set to one more than the received sequence number i.e. A+1, and the sequence number that the server chooses for the packet is another random number, B.
- ACK: Finally, the client sends an ACK back to the server. The sequence number is set to the received acknowledgement value i.e. A+1, and the acknowledgement number is set to one more than the received sequence number i.e. B+1.
0 0
- TCP与UDP的区别
- TCP与UDP的区别
- tcp与udp的区别
- TCP与UDP的区别
- TCP与UDP的区别
- TCP与UDP的区别
- TCP与UDP的区别
- TCP与UDP的区别
- TCP与UDP的区别
- TCP与UDP的区别
- TCP与UDP的区别
- TCP与UDP的区别
- tcp与udp的区别
- TCP与UDP的区别
- TCP与UDP的区别
- tCp 与 UDp 的区别
- TCP与UDP的区别 .
- TCP与UDP的区别
- 微软等数据结构+算法面试100题全部答案集锦
- android:theme和app:popupTheme的作用,以及在android 3.0以下不起作用问题的解决
- PS混合模式
- C++模板
- JavaScript Array 对象splice() 方法
- TCP与UDP的区别
- getFragmentManager和getChildFragmentManager使用不当导致viewpager不加载fragment
- Keepalived 安装 配置
- java中InputStream中read()与read(byte[] b) 用法介绍
- turnjs4翻书效果
- 排序算法复杂度比较
- Java Web添加HTTP服务
- 二叉树的先序/中序/后序/层次遍历
- POJ 题目1185 炮兵阵地(状压DP)