1. 程式人生 > 實用技巧 >tcp和udp協議的相似_比較TCP與UDP協議,區別和相似之處

tcp和udp協議的相似_比較TCP與UDP協議,區別和相似之處

tcp和udp協議的相似

tcp和udp協議的相似

Networks are used to transmit data over the world. There is a lot of network protocols in use. But most known and used protocols are IP, TCP, UDP. IP lives different flat but TCP and UDP try to live the same flat. So they operate the same network layer but what is different between UDP and TCP. Why should I use TCP or not use? The same questions can be asked for UDP too. In this post, we will look at what is the same and different for these protocols. TCP stands for Transmission Control Protocol. UDP stands for User Datagram Protocol

網路用於在世界範圍內傳輸資料。 有許多網路協議正在使用中。 但是,最知名和使用的協議是IP,TCP,UDP。 IP生活在不同的公寓中,但TCP和UDP嘗試居住在同一公寓中。 因此,它們使用相同的網路層,但是UDP和TCP之間的區別是什麼。 為什麼要使用TCP或不使用TCP? 對於UDP也可以詢問相同的問題。 在本文中,我們將探討這些協議的相同點和不同點。 TCP代表傳輸控制協議。 UDP代表使用者資料報協議

OSI網路層(OSI Network Layer)

They both live the same Layer according to the OSI Reference Model. We call this layer as Transmission Layer. In this layer between sockets, data is transmitted. They have no difference in this side.

根據OSI參考模型,它們都位於同一層。 我們將此層稱為傳輸層。 在套接字之間的這一層中,傳輸資料。 他們在這方面沒有區別。

封包結構 (Packet Structure)

UDP
UDP
UDP協議

UDP has a lean package structure. UDP provides just Source, Destination Port, Length, Checksum in its header part.

UDP具有精益包結構。 UDP在其標頭部分僅提供源,目標埠,長度,校驗和。

TCP
TCP
TCP協議

TCP has more fields in the package because TCP transmission has more steps and controls for package delivery. TCP has 12 header fields.

TCP在程式包中包含更多欄位,因為TCP傳輸具有更多程式包傳遞步驟和控制元件。 TCP具有12個標頭欄位。

複雜 (Complexity)

TCP is absolutely more complex than UDP protocol. As we see in the upper side TCP have a lot of area for transmission-related mechanisms. For example, TCP provides the mechanism of a window which sets transmission buffer related memory. UDP has just checksum mechanism and packet counter which is sometimes not implemented.

TCP絕對比UDP協議複雜。 正如我們在上側所看到的,TCP具有許多與傳輸相關的機制。 例如,TCP提供了設定傳輸緩衝區相關記憶體的視窗機制。 UDP只是具有校驗和機制和資料包計數器,有時無法實現。

演算法 (Algorithm)

To transmit data with TCP a session must be created with a method named 3-way handshake. The first client sends a packet with the SYN flag is set and the server responds with ACK flags and the last step the client sends SYNC+ACK to accomplish a TCP session with the related server. UDP does not have any special algorithm. UDP packages are directly sent to the server’s port. Management did generally in the upper application layer.

要使用TCP傳輸資料,必須使用名為3向握手的方法建立會話。 第一個客戶端傳送設定了SYN標誌的資料包,伺服器使用ACK標誌進行響應,最後一步,客戶端傳送SYNC + ACK以完成與相關伺服器的TCP會話。 UDP沒有任何特殊演算法。 UDP包直接傳送到伺服器的埠。 管理通常在上層應用程式層進行。

LEARN MORE Linux fuser Command Tutorial With Examples 瞭解更多Linux融合器命令教程和示例

速度(Speed)

The complexity of TCP protocol makes TCP slower than UDP. At least to send just a single byte there needs to be a session initialization and after data transfer closes the session. This makes TCP slower. There is some work done about the speed of TCP but the architecture is limited new enhancements. UDP is lightfast if you transmit it over fiber optic;).UDP is fast because there are no algorithms for session or session termination.

TCP協議的複雜性使TCP比UDP慢。 至少要僅傳送一個位元組,就需要進行會話初始化,並且在資料傳輸關閉會話之後。 這會使TCP變慢。 關於TCP的速度已經完成了一些工作,但是該體系結構在新的增強功能方面受到限制。 如果通過光纖傳輸UDP,則UDP很快;)。UDP很快,因為沒有用於會話或會話終止的演算法。

可靠性 (Reliability)

TCP is a reliable protocol because it runs mechanisms to prevent data loss or change. TCP uses sessions to make data transmission reliability. Also in the data transfer, transmitted data is checked by between sides, and if some loss or change occurred data is re-transmitted again. UDP is nor reliable. Really it is not. But if you want it to be reliable upper layer application-level mechanisms can be implemented but these will make the transmission more complex.

TCP是一種可靠的協議,因為它執行防止資料丟失或更改的機制。 TCP使用會話來確保資料傳輸的可靠性。 同樣在資料傳輸中,通過雙方之間檢查傳送的資料,並且如果發生某些丟失或更改,則再次重新發送資料。 UDP也不可靠。 真的不是。 但是,如果您希望它可靠,則可以實施上層應用程式級機制,但這會使傳輸更加複雜。

安全 (Security)

From the security point of view, both TCP and UDP are the same. Actually, TCP has some little advantages because of its session management but for a general look, there are both secure if security mechanisms like SSL, Encryption is implemented. Implementing SSL/TLS like protocols for TCP is very easy besides UDP. On the other side, voice communication protocols like RTP can be upgraded to the SRTP to make underlying UDP more secure.

從安全形度來看,TCP和UDP都是相同的。 實際上,由於會話管理,TCP幾乎沒有什麼優勢,但是從總體上看,如果實現了SSL,加密等安全機制,則兩者都是安全的。 除了UDP之外,為TCP實現類似SSL / TLS的協議也非常容易。 另一方面,可以將語音通訊協議(如RTP)升級到SRTP,以使基礎UDP更安全。

規約 (Protocols)

In this part, we will list protocols using UDP or TCP or both.

在這一部分中,我們將列出使用UDP或TCP或兩者的協議。

UDP協議 (UDP)

The following protocols are using UDP transmission.

以下協議正在使用UDP傳輸。

  • DHCP

    DHCP伺服器
  • DNS

    域名解析
  • Streaming

    流媒體
  • RDP

    RDP
  • TFTP

    TFTP
  • SNMP

    SNMP協議
  • VOIP

    網路電話
LEARN MORE How To Get Mac Address In Windows? 瞭解更多如何在Windows中獲取Mac地址?

TCP協議 (TCP)

The following protocols are using TCP transmission.

以下協議正在使用TCP傳輸。

  • HTTP

    HTTP
  • HTTPS

    HTTPS
  • FTP

    的FTP
  • SMTP

    SMTP
  • TELNET

    電信網

翻譯自: https://www.poftut.com/compare-tcp-vs-udp-protocols-differences-and-similarities/

tcp和udp協議的相似