2024年3月27日发(作者:)

TCP与UDP区别

TCP---传输控制协议,提供的是面向连接、可靠的字节流服务。当客户和服务器

彼此交换数据前,必须先在双方之间建立一个TCP连接,之后才能传输数据。TCP

提供超时重发,丢弃重复数据,检验数据,流量控制等功能,保证数据能从一端

传到另一端。

UDP---用户数据报协议,是一个简单的面向数据报的运输层协议。UDP不提供可

靠性,它只是把应用程序传给IP层的数据报发送出去,但是并不能保证它 们能

到达目的地。由于UDP在传输数据报前不用在客户和服务器之间建立一个连接,

且没有超时重发等机制,故而传输速度很快

Overview

TCP (Transmission Control Protocol) is the most commonly used protocol

on the Internet. The reason for this is because TCP offers error correction.

When the TCP protocol is used there is a "guaranteed delivery." This is

due largely in part to a method called "flow control." Flow control

determines when data needs to be re-sent, and stops the flow of data until

previous packets are successfully transferred. This works because if a

packet of data is sent, a collision may occur. When this happens, the

client re-requests the packet from the server until the whole packet is

complete and is identical to its original.

UDP (User Datagram Protocol) is anther commonly used protocol on the

Internet. However, UDP is never used to send important data such as

webpages, database information, etc; UDP is commonly used for streaming

audio and video. Streaming media such as Windows Media audio files (.WMA) ,

Real Player (.RM), and others use UDP because it offers speed! The reason

UDP is faster than TCP is because there is no form of flow control or error

correction. The data sent over the Internet is affected by collisions,

and errors will be present. Remember that UDP is only concerned with speed.

This is the main reason why streaming media is not high quality.

On the contrary, UDP has been implemented among some trojan horse viruses.

Hackers develop scripts and trojans to run over UDP in order to mask their

activities. UDP packets are also used in DoS (Denial of Service) attacks.

It is important to know the difference between TCP port 80 and UDP port

80. If you don't know what ports are go here.

Frame Structure

As data moves along a network, various attributes are added to the file

to create a

frame

. This process is called

encapsulation

. There are

different methods of encapsulation depending on which protocol and

topology are being used. As a result, the frame structure of these packets