TCP vs UDP (2024)

Differences in Data Transfer Features

TCP ensures a reliable and ordered delivery of a stream of bytes from user to server or vice versa. UDP is not dedicated to end to end connections and communication does not check readiness of receiver.

Reliability

TCP is more reliable since it manages message acknowledgment and retransmissions in case of lost parts. Thus there is absolutely no missing data. UDP does not ensure that communication has reached receiver since concepts of acknowledgment, time out and retransmission are not present.

Ordering

TCP transmissions are sent in a sequence and they are received in the same sequence. In the event of data segments arriving in wrong order, TCP reorders and delivers application. In the case of UDP, sent message sequence may not be maintained when it reaches receiving application. There is absolutely no way of predicting the order in which message will be received.

Connection

TCP is a heavy weight connection requiring three packets for a socket connection and handles congestion control and reliability. UDP is a lightweight transport layer designed atop an IP. There are no tracking connections or ordering of messages.

Method of transfer

TCP reads data as a byte stream and message is transmitted to segment boundaries. UDP messages are packets which are sent individually and on arrival are checked for their integrity. Packets have defined boundaries while data stream has none.

Error Detection

UDP works on a "best-effort" basis. The protocol supports error detection via checksum but when an error is detected, the packet is discarded. Retransmission of the packet for recovery from that error is not attempted. This is because UDP is usually for time-sensitive applications like gaming or voice transmission. Recovery from the error would be pointless because by the time the retransmitted packet is received, it won't be of any use.

TCP uses both error detection and error recovery. Errors are detected via checksum and if a packet is erroneous, it is not acknowledged by the receiver, which triggers a retransmission by the sender. This operating mechanism is called Positive Acknowledgement with Retransmission (PAR).

How TCP and UDP work

A TCP connection is established via a three way handshake, which is a process of initiating and acknowledging a connection. Once the connection is established data transfer can begin. After transmission, the connection is terminated by closing of all established virtual circuits.

UDP uses a simple transmission model without implicit hand-shaking dialogues for guaranteeing reliability, ordering, or data integrity. Thus, UDP provides an unreliable service and datagrams may arrive out of order, appear duplicated, or go missing without notice. UDP assumes that error checking and correction is either not necessary or performed in the application, avoiding the overhead of such processing at the network interface level. Unlike TCP, UDP is compatible with packet broadcasts (sending to all on local network) and multicasting (send to all subscribers).

Different Applications of TCP and UDP

Web browsing, email and file transfer are common applications that make use of TCP. TCP is used to control segment size, rate of data exchange, flow control and network congestion. TCP is preferred where error correction facilities are required at network interface level. UDP is largely used by time sensitive applications as well as by servers that answer small queries from huge number of clients. UDP is compatible with packet broadcast - sending to all on a network and multicasting – sending to all subscribers. UDP is commonly used in Domain Name System, Voice over IP, Trivial File Transfer Protocol and online games.

TCP vs. UDP for Game Servers

For massively multiplayer online (MMO) games, developers often have to make an architectural choice between using UDP or TCP persistent connections. The advantages of TCP are persistent connections, reliability, and being able to use packets of arbitrary sizes. The biggest problem with TCP in this scenario is its congestion control algorithm, which treats packet loss as a sign of bandwidth limitations and automatically throttles the sending of packets. On 3G or Wi-Fi networks, this can cause a significant latency.

Experienced developer Christoffer Lernö weighed the pros and cons and recommends the following criteria to choose whether to use TCP or UDP for your game:

  • Use HTTP over TCP for making occasional, client-initiated stateless queries when it's OK to have an occasional delay.
  • Use persistent plain TCP sockets if both client and server independently send packets but an occasional delay is OK (e.g. Online Poker, many MMOs).
  • Use UDP if both client and server may independently send packets and occasional lag is not OK (e.g. Most multiplayer action games, some MMOs).

References

TCP vs UDP (2024)
Top Articles
Mastering Crowdfunding Marketing: A Comprehensive Guide for Success
Mew vs Mewtwo: Which Pokemon Will Win? (2024 Updated)
Netronline Taxes
Www.1Tamilmv.cafe
Cumberland Maryland Craigslist
Melfme
Optimal Perks Rs3
Unraveling The Mystery: Does Breckie Hill Have A Boyfriend?
Ecers-3 Cheat Sheet Free
My.doculivery.com/Crowncork
zopiclon | Apotheek.nl
No Strings Attached 123Movies
Ivegore Machete Mutolation
Insidekp.kp.org Hrconnect
Premier Reward Token Rs3
Fool’s Paradise movie review (2023) | Roger Ebert
Are They Not Beautiful Wowhead
Wisconsin Women's Volleyball Team Leaked Pictures
Velocity. The Revolutionary Way to Measure in Scrum
The Exorcist: Believer (2023) Showtimes
E22 Ultipro Desktop Version
Why Should We Hire You? - Professional Answers for 2024
Quest: Broken Home | Sal's Realm of RuneScape
Rufus Benton "Bent" Moulds Jr. Obituary 2024 - Webb & Stephens Funeral Homes
Pasco Telestaff
Terry Bradshaw | Biography, Stats, & Facts
Okc Body Rub
Wkow Weather Radar
Chamberlain College of Nursing | Tuition & Acceptance Rates 2024
Boise Craigslist Cars And Trucks - By Owner
Finding Safety Data Sheets
Booknet.com Contract Marriage 2
Random Bibleizer
Craigslist Auburn Al
Craigslist Boerne Tx
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Blackstone Launchpad Ucf
Los Garroberros Menu
Winco Money Order Hours
Mid America Clinical Labs Appointments
Noaa Duluth Mn
Cl Bellingham
Trivago Sf
Joey Gentile Lpsg
Shell Gas Stations Prices
Ups Authorized Shipping Provider Price Photos
Missed Connections Dayton Ohio
Used Auto Parts in Houston 77013 | LKQ Pick Your Part
Jesus Calling Oct 6
ats: MODIFIED PETERBILT 389 [1.31.X] v update auf 1.48 Trucks Mod für American Truck Simulator
Cataz.net Android Movies Apk
Supervisor-Managing Your Teams Risk – 3455 questions with correct answers
Latest Posts
Article information

Author: Otha Schamberger

Last Updated:

Views: 5540

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Otha Schamberger

Birthday: 1999-08-15

Address: Suite 490 606 Hammes Ferry, Carterhaven, IL 62290

Phone: +8557035444877

Job: Forward IT Agent

Hobby: Fishing, Flying, Jewelry making, Digital arts, Sand art, Parkour, tabletop games

Introduction: My name is Otha Schamberger, I am a vast, good, healthy, cheerful, energetic, gorgeous, magnificent person who loves writing and wants to share my knowledge and understanding with you.