Net-informations.com

Difference between TCP and UDP

In networking, a protocol is a standardized way of doing certain things and formatting data so that two or more devices are able to communicate with and understand each other. Many different types of network protocols and standards are required to ensure that your computer can communicate with another computer located on the other side or half-way around the world. Most network protocol suites are viewed as structured in layers . This is a result of the OSI (Open Systems Interconnect) Reference Model designed by the ISO (International Standards Organization). The following image illustrates the place of the internet protocol in the protocol hierarchy:


How network protocols work tcp udp

Internet Protocol (IP)

The Internet Protocol (IP) is a protocol, or set of rules, for routing and addressing packets of data so that they can travel across networks and arrive at the correct destination. The TCP/IP protocol of Layer 4 (transport layer) has two protocols: TCP and UDP. TCP and UDP are not the only protocols that work on top of Internet Protocol . However, they are the most widely used. Both are protocols used for sending bits of data(known as packets) over the Internet. Also, both use port (or socket) numbers to pass information to the upper layers.

TCP

Transmission Control Protocol ( TCP ) is the most commonly used protocol on the Internet. The reason for this is because TCP offers error correction . This means that TCP is a connection oriented stream over an IP network and it guarantees that all sent packets will reach the destination in the correct order . This is due largely in part to a method called "flow control" . It determines when data needs to be re-sent, and stops the flow of data until previous packets are successfully transferred. This imply the use of acknowledgement packets sent back to the sender, and automatic retransmission , causing additional delays and a general less efficient transmission than UDP.

Characteristics of TCP

  1. Connection-oriented.
  2. Reliable.
  3. Divides outgoing messages into segments.
  4. Reassembles messages at the destination station.
  5. Re-sends anything not received.
  6. Reassembles messages from incoming segments.

Examples of TCP in real life

  1. World Wide Web(HTTP)
  2. E-mail (SMTP TCP)
  3. File Transfer Protocol (FTP)
  4. Secure Shell (SSH)

UDP

User Datagram Protocol ( UDP ) is a connection-less protocol. It is faster but less reliable than TCP. The integrity is guaranteed only on the single datagram . Datagrams reach destination and can arrive out of order or don't arrive at all. It sends packets directly to a target computer, without establishing a connection first, indicating the order of said packets, or checking whether they arrived as intended. So, UDP is never used to send important data such as webpages, database information, etc. It's generally used for real time communication, where a little percentage of packet loss rate is preferable to the overhead of a TCP connection . It is important to note that UDP is only concerned with speed. This is the main reason why streaming media is not high quality.

Characteristics of UDP

  1. Connectionless.
  2. Unreliable.
  3. Transmit messages (called user datagrams).
  4. Provides no software checking for message delivery (unreliable).
  5. Does not reassemble incoming messages.
  6. Uses no acknowledgments.
  7. Provides no flow control.

Examples of UDP in real life

  1. Domain Name System (DNS)
  2. Streaming media applications such as movies
  3. Online multiplayer games
  4. Voice over IP (VoIP)
  5. Trivial File Transfer Protocol (TFTP)

Types Network protocols tcp udp

Summary: TCP Vs. UDP

  1. TCP is connection oriented and reliable where as UDP is connection less and unreliable.
  2. TCP is heavy-weight, and UDP is lightweight.
  3. Header size is 20 bytes while UDP header size is 8 bytes.
  4. The speed for TCP is slower while the speed of UDP is faster.
  5. TCP uses handshake protocol like SYN, SYN-ACK, ACK while UDP uses no handshake protocols.
  6. TCP does error checking and also makes error recovery, on the other hand, UDP performs error checking, but it discards erroneous packets.
  7. TCP reads data as streams of bytes, and the message is transmitted to segment boundaries while UDP messages contain packets that were sent one by one. It also checks for integrity at the arrival time.


NEXT.....Modem vs. Router: What's the Difference?