SlideShare a Scribd company logo
6
TCP/IP & UDP
Computer Networks (CSI-504)
Prepared By: Ghayour Abbas
Outline:
• TCP/IP
• UDP
TCP
Transmission Control Protocol (TCP) widely known as Internet Protocol (IP) is a
set of communications protocols used over the internet for delivery of services or
packets within or across the network. It is commonly known as internet protocol
suite.
The TCP/IP protocol consists of four layers such as link layer, network layer,
transport layer, and application layer.
Each layer adds addresses to the protocol stack as a physical address, logical
address, port address, and application-specific address.
TCP is a connection-oriented point-to-point transport communication
protocol that sends data packets as an unstructured stream of bytes in an ordered
sequence. TCP provides information from sending node about the delivery of
packets transmitted to a destination node by using sequence numbers and
acknowledgment messages. TCP ensures reliability, end-to-end delivery,
resequencing and retransmitting of data until a timeout condition is reached or
acknowledgment of data packets is received.
TCP offers flow control mechanism to sustain high transmission of packets
over a speeding network as well as TCP protocols offer error detection and lost
data features by trigging retransmission of data packets until an error-free
acknowledgment is received. The TCP/IP protocol maintains communication with
application layer protocols such as (FTP) file transfer protocol, (SMTP) simple
mail transfer protocol, and (HTTP) hypertext transfer protocol.
UDP
User Datagram Protocol (UDP) is a connectionless transport layer
communication protocol used to establish low tolerating and loss latency
connections for delivery of services or packets within or across the network.
It is coupled with an internet protocol suite as an alternative to TCP/IP
protocol. UDP constructs a datagram packet and addresses it with a port number
of IP appended with data packets and optional checksum capability to verify
receipt of intact data arrival. Since UDP protocol is simple protocol, the
retransmissions of packets can be decided at sender’s end whether to trade low
latency for high reliability over data transmission. UDP reduces overall network
traffic owing to network broadcasts feature which broadcasts packets to some
computers on the same network and eliminates the need for duplication across
the network. As UDP is connectionless protocol, the delivery or order of the data
content packets varies.
UDP conjunctions with higher level protocols such as trivial file transfer
protocol, real-time streaming protocol, simple network protocol, and domain
name system lookups to manage data transmission services across the network.
TCP Vs. UDP
Data Transfer Features
TCP enables the establishment of a strong connection between two hosts to
exchange data in streams. TCP guarantees to deliver data in the same ordered
manner as sent from server to user and vice versa. Thus, TCP is a connection-
oriented protocol. However, UDP is connectionless and non-dedicated protocol
does not check the readiness of the receiver host.
Reliability
Reliability of TCP is comparatively higher as it ensures message acknowledgment
and retransmissions of data in case of loss of data parts in transit. Hence, the
hosts do not lose any missing data. On the other hand, UDP does not offer
concepts of message acknowledgments, time-out or retransmission feature.
Therefore, there is no communication of whether the packets have reached
receiver or lost in transit.
Sequence
TCP transmits data packets in the same sequence as received. In case data
packets are arriving in the wrong order, TCP reorders them and delivers in the
correct order. In case of UDP, messages sent in a particular sequence may or may
not be maintained while delivering the host. Therefore, the sequence or order in
which packets will be transmitted is unpredictable.
Connection
A TCP connection is heavyweight, and it requires almost three packets for an
appropriate socket connection and handles the congestion control and reliable
delivery. UDP connection, on the other hand, is lightweight and transports layers
designed over a particular IP. No connections are tracking or ordering of
messages.
Data Streaming
Transmission Control Protocol reads data as streams of bytes, and the message is
transmitted to segment boundaries. UDP messages contain packets that were
sent one by one and are checked for integrity at the time of arrival.
Transfer Speed
The speed of TCP is slower as compared to UDP as it checks for errors and
retransmits the packets.
Header Size
TCP’s size of the header is 20 bytes, whereas, UDP is 8 bytes. However, they have
common header fields that are, source point, destination point, and checksum.
8 bits equal 1 byte.
TCP headers appear in the following sequence, beginning with the source
and destination communication endpoints:
• Source TCP port number (2 bytes or 16 bits): The source TCP port
number represents the sending device.
• Destination TCP port number (2 bytes or 16 bits): The destination
TCP port number is the communication endpoint for the receiving
device.
• Sequence number (4 bytes or 32 bits): Message senders use
sequence numbers to mark the ordering of a group of messages.
• Acknowledgment number (4 bytes or 32 bits): Both senders and
receivers use the acknowledgment numbers field to communicate
the sequence numbers of messages that are either recently received
or expected to be sent.
• TCP data offset (4 bits): The data offset field stores the total size of a
TCP header in multiples of four bytes. A header not using the
optional TCP field has a data offset of 5 (representing 20 bytes), while
a header using the maximum-sized optional field has a data offset of
15 (representing 60 bytes).
• Reserved data (3 bits): Reserved data in TCP headers always has a
value of zero. This field aligns the total header size as a multiple of
four bytes, which is important for the efficiency of computer data
processing.
• Control flags (up to 9 bits): TCP uses a set of six standard and three
extended control flags—each an individual bit representing On or
Off—to manage data flow in specific situations.
• Window size (2 bytes or 16 bits): TCP senders use a number,
called window size, to regulate how much data they send to a
receiver before requiring an acknowledgment in return. If the
window size is too small, network data transfer is unnecessarily slow.
If the window size is too large, the network link may become
saturated, or the receiver may not be able to process incoming data
quickly enough, resulting in slow performance. Windowing
algorithms built into the protocol dynamically calculate size values
and use this field of TCP headers to coordinate changes between
senders and receivers.
• TCP checksum (2 bytes or 16 bits): The checksum value inside a TCP
header is generated by the protocol sender as a mathematical
technique to help the receiver detect messages that are corrupted or
tampered with.
• Urgent pointer (2 bytes or 16 bits): The urgent pointer field is often
set to zero and ignored, but in conjunction with one of the control
flags, it can be used as a data offset to mark a subset of a message as
requiring priority processing.
• TCP optional data (0 to 40 bytes): Usages of optional TCP data
include support for special acknowledgment and window scaling
algorithms.
UDP Header Format
Because UDP is limited in capability compared to TCP, its headers are
smaller. A UDP header contains 8 bytes, divided into the following four
required fields:
• Source UDP port number (2 bytes): The source UDP port number
represents the sending device.
• Destination UDP port number (2 bytes): The destination UDP port
number is the communication endpoint for the receiving device.
• Length of data (2 bytes): The length field in UDP represents the total
size of each datagram, including both header and data. This field
ranges in value from a minimum of 8 bytes—the required header
size—to sizes above 65,000 bytes.
• UDP checksum (2 bytes): Similar to TCP, a UDP checksum allows
receivers to cross-check incoming data for any corrupted bits of the
message.
Usage by Other Protocols
Use by other protocols FTP, SMTP, HTTP, HTTPs, Telnet use TCP Protocols, and
UDP protocols are used by TFTP, SNMP, DNS, DHCP, RIP, VOIP.
Detection of Errors
Transmission Control Protocol detects errors via checksum and performs error
recovery. If any of the packets are erroneous, they do not get acknowledged by
the receiver, which in turn triggers re-transmission by host/sender.
This mechanism is known as PAR (Positive Acknowledgement with
Retransmission). Since TCP is slower than UDP, TCP is appropriate for applications
that do not require high speed or longer period took for transmission is not a
constraint.
Regarding error detection and error recovery, UDP works on a best effort basis.
This protocol also supports error detection. However, the erroneous packets
detected by checksum are discarded. UDP does not attempt to retransmit
packets.
The reason UDP does not attempt retransmission of packets is that this protocol is
commonly used for time-sensitive applications such as voice transmission,
gaming, etc. Hence, recovery attempt would be of no point as by the time
retransmission takes place, and the packets are received, they will be of no use.

More Related Content

PDF
Unit 4 tansport layer in the internat
DOCX
Udp vs-tcp
PPTX
Transport layer.pptx
DOCX
Tcp vs udp
PPTX
Unit 6 NAHI aa rha hai na ki koi baat nhi hai
PPT
TCP/IP Basics
PPTX
Unit 5.Transport Layer.pptx
PPTX
REMnux tutorial 4.1 - Datagrams, Fragmentation & Anomalies
Unit 4 tansport layer in the internat
Udp vs-tcp
Transport layer.pptx
Tcp vs udp
Unit 6 NAHI aa rha hai na ki koi baat nhi hai
TCP/IP Basics
Unit 5.Transport Layer.pptx
REMnux tutorial 4.1 - Datagrams, Fragmentation & Anomalies

Similar to TCP/IP & UDP (20)

PDF
TCP Vs UDP
PPT
計概
PPTX
TCP and UDP comparison and itsi application.pptx
PPTX
TRANSPORT LAYER ppt.pptx
PDF
Transport layer services
PPT
Transport protocols
PDF
Chapter03 sg
PPTX
Online TCP-IP Networking Assignment Help
PPTX
TCP_UDP_presention_for_network_transtion.pptx
PPTX
tcp-ippresentation-150614172243-lva1-app6892.pptx
PPTX
TCP_NISCHAYBAHL.pptx
PPTX
Transmission control protocol (TCP) Group 6 (1).pptx
PPTX
Transport layer protocol
PDF
TCP - IP Presentation
PPTX
Tcp ip presentation
PPTX
ppt of computer netwokrs.cse engineering.part 5
PPTX
TCP/IP Introduction
PPTX
Mcseminar
PPTX
Transport_Layer_Protocols.pptx
TCP Vs UDP
計概
TCP and UDP comparison and itsi application.pptx
TRANSPORT LAYER ppt.pptx
Transport layer services
Transport protocols
Chapter03 sg
Online TCP-IP Networking Assignment Help
TCP_UDP_presention_for_network_transtion.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptx
TCP_NISCHAYBAHL.pptx
Transmission control protocol (TCP) Group 6 (1).pptx
Transport layer protocol
TCP - IP Presentation
Tcp ip presentation
ppt of computer netwokrs.cse engineering.part 5
TCP/IP Introduction
Mcseminar
Transport_Layer_Protocols.pptx
Ad

More from ghayour abbas (20)

PDF
Web Development 5
PDF
Web Development 4
PDF
Web Development 4 (HTML & CSS)
PDF
Web Development 3 (HTML & CSS)
PDF
Lab Manual CSI-321
PDF
Web Development 2 (HTML & CSS)
PDF
Web Development 1 (HTML & CSS)
PDF
CSI-503 - 13. Scheduler and Dispatcher
PDF
CSI-503 - 11.Distributed Operating System
PDF
SWE-401 - 10. Software Testing Overview
PDF
SWE-401 - 9. Software Implementation
PDF
SWE-401 - 8. Software User Interface Design
PDF
SWE-401 - 7. Software Design Strategies
PDF
SWE-401 - 5. Software Design Basics
PDF
SWE-401 - 6. Software Analysis and Design Tools
PDF
SWE-401 - 4. Software Requirement Specifications
PDF
SWE-401 - 3. Software Project Management
PDF
CSI-503 - 6. Memory Management
PDF
CSI-503 - 4. Process synchronization
PDF
CSI-503 - 3. Process Scheduling
Web Development 5
Web Development 4
Web Development 4 (HTML & CSS)
Web Development 3 (HTML & CSS)
Lab Manual CSI-321
Web Development 2 (HTML & CSS)
Web Development 1 (HTML & CSS)
CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 11.Distributed Operating System
SWE-401 - 10. Software Testing Overview
SWE-401 - 9. Software Implementation
SWE-401 - 8. Software User Interface Design
SWE-401 - 7. Software Design Strategies
SWE-401 - 5. Software Design Basics
SWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 4. Software Requirement Specifications
SWE-401 - 3. Software Project Management
CSI-503 - 6. Memory Management
CSI-503 - 4. Process synchronization
CSI-503 - 3. Process Scheduling
Ad

Recently uploaded (20)

PPTX
Pharma ospi slides which help in ospi learning
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Cell Structure & Organelles in detailed.
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Lesson notes of climatology university.
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Institutional Correction lecture only . . .
Pharma ospi slides which help in ospi learning
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Cell Structure & Organelles in detailed.
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Sports Quiz easy sports quiz sports quiz
human mycosis Human fungal infections are called human mycosis..pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Complications of Minimal Access Surgery at WLH
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Lesson notes of climatology university.
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Microbial diseases, their pathogenesis and prophylaxis
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Insiders guide to clinical Medicine.pdf
Institutional Correction lecture only . . .

TCP/IP & UDP

  • 1. 6 TCP/IP & UDP Computer Networks (CSI-504) Prepared By: Ghayour Abbas Outline: • TCP/IP • UDP TCP Transmission Control Protocol (TCP) widely known as Internet Protocol (IP) is a set of communications protocols used over the internet for delivery of services or packets within or across the network. It is commonly known as internet protocol suite. The TCP/IP protocol consists of four layers such as link layer, network layer, transport layer, and application layer. Each layer adds addresses to the protocol stack as a physical address, logical address, port address, and application-specific address.
  • 2. TCP is a connection-oriented point-to-point transport communication protocol that sends data packets as an unstructured stream of bytes in an ordered sequence. TCP provides information from sending node about the delivery of packets transmitted to a destination node by using sequence numbers and acknowledgment messages. TCP ensures reliability, end-to-end delivery, resequencing and retransmitting of data until a timeout condition is reached or acknowledgment of data packets is received. TCP offers flow control mechanism to sustain high transmission of packets over a speeding network as well as TCP protocols offer error detection and lost data features by trigging retransmission of data packets until an error-free acknowledgment is received. The TCP/IP protocol maintains communication with application layer protocols such as (FTP) file transfer protocol, (SMTP) simple mail transfer protocol, and (HTTP) hypertext transfer protocol. UDP User Datagram Protocol (UDP) is a connectionless transport layer communication protocol used to establish low tolerating and loss latency connections for delivery of services or packets within or across the network. It is coupled with an internet protocol suite as an alternative to TCP/IP protocol. UDP constructs a datagram packet and addresses it with a port number of IP appended with data packets and optional checksum capability to verify receipt of intact data arrival. Since UDP protocol is simple protocol, the retransmissions of packets can be decided at sender’s end whether to trade low latency for high reliability over data transmission. UDP reduces overall network traffic owing to network broadcasts feature which broadcasts packets to some computers on the same network and eliminates the need for duplication across the network. As UDP is connectionless protocol, the delivery or order of the data content packets varies. UDP conjunctions with higher level protocols such as trivial file transfer protocol, real-time streaming protocol, simple network protocol, and domain name system lookups to manage data transmission services across the network.
  • 3. TCP Vs. UDP Data Transfer Features TCP enables the establishment of a strong connection between two hosts to exchange data in streams. TCP guarantees to deliver data in the same ordered manner as sent from server to user and vice versa. Thus, TCP is a connection- oriented protocol. However, UDP is connectionless and non-dedicated protocol does not check the readiness of the receiver host. Reliability Reliability of TCP is comparatively higher as it ensures message acknowledgment and retransmissions of data in case of loss of data parts in transit. Hence, the hosts do not lose any missing data. On the other hand, UDP does not offer concepts of message acknowledgments, time-out or retransmission feature. Therefore, there is no communication of whether the packets have reached receiver or lost in transit. Sequence TCP transmits data packets in the same sequence as received. In case data packets are arriving in the wrong order, TCP reorders them and delivers in the correct order. In case of UDP, messages sent in a particular sequence may or may not be maintained while delivering the host. Therefore, the sequence or order in which packets will be transmitted is unpredictable. Connection A TCP connection is heavyweight, and it requires almost three packets for an appropriate socket connection and handles the congestion control and reliable delivery. UDP connection, on the other hand, is lightweight and transports layers designed over a particular IP. No connections are tracking or ordering of messages. Data Streaming Transmission Control Protocol reads data as streams of bytes, and the message is transmitted to segment boundaries. UDP messages contain packets that were sent one by one and are checked for integrity at the time of arrival.
  • 4. Transfer Speed The speed of TCP is slower as compared to UDP as it checks for errors and retransmits the packets. Header Size TCP’s size of the header is 20 bytes, whereas, UDP is 8 bytes. However, they have common header fields that are, source point, destination point, and checksum.
  • 5. 8 bits equal 1 byte. TCP headers appear in the following sequence, beginning with the source and destination communication endpoints: • Source TCP port number (2 bytes or 16 bits): The source TCP port number represents the sending device. • Destination TCP port number (2 bytes or 16 bits): The destination TCP port number is the communication endpoint for the receiving device. • Sequence number (4 bytes or 32 bits): Message senders use sequence numbers to mark the ordering of a group of messages. • Acknowledgment number (4 bytes or 32 bits): Both senders and receivers use the acknowledgment numbers field to communicate the sequence numbers of messages that are either recently received or expected to be sent. • TCP data offset (4 bits): The data offset field stores the total size of a TCP header in multiples of four bytes. A header not using the optional TCP field has a data offset of 5 (representing 20 bytes), while a header using the maximum-sized optional field has a data offset of 15 (representing 60 bytes).
  • 6. • Reserved data (3 bits): Reserved data in TCP headers always has a value of zero. This field aligns the total header size as a multiple of four bytes, which is important for the efficiency of computer data processing. • Control flags (up to 9 bits): TCP uses a set of six standard and three extended control flags—each an individual bit representing On or Off—to manage data flow in specific situations. • Window size (2 bytes or 16 bits): TCP senders use a number, called window size, to regulate how much data they send to a receiver before requiring an acknowledgment in return. If the window size is too small, network data transfer is unnecessarily slow. If the window size is too large, the network link may become saturated, or the receiver may not be able to process incoming data quickly enough, resulting in slow performance. Windowing algorithms built into the protocol dynamically calculate size values and use this field of TCP headers to coordinate changes between senders and receivers. • TCP checksum (2 bytes or 16 bits): The checksum value inside a TCP header is generated by the protocol sender as a mathematical technique to help the receiver detect messages that are corrupted or tampered with. • Urgent pointer (2 bytes or 16 bits): The urgent pointer field is often set to zero and ignored, but in conjunction with one of the control flags, it can be used as a data offset to mark a subset of a message as requiring priority processing. • TCP optional data (0 to 40 bytes): Usages of optional TCP data include support for special acknowledgment and window scaling algorithms. UDP Header Format Because UDP is limited in capability compared to TCP, its headers are smaller. A UDP header contains 8 bytes, divided into the following four required fields:
  • 7. • Source UDP port number (2 bytes): The source UDP port number represents the sending device. • Destination UDP port number (2 bytes): The destination UDP port number is the communication endpoint for the receiving device. • Length of data (2 bytes): The length field in UDP represents the total size of each datagram, including both header and data. This field ranges in value from a minimum of 8 bytes—the required header size—to sizes above 65,000 bytes. • UDP checksum (2 bytes): Similar to TCP, a UDP checksum allows receivers to cross-check incoming data for any corrupted bits of the message. Usage by Other Protocols Use by other protocols FTP, SMTP, HTTP, HTTPs, Telnet use TCP Protocols, and UDP protocols are used by TFTP, SNMP, DNS, DHCP, RIP, VOIP. Detection of Errors Transmission Control Protocol detects errors via checksum and performs error recovery. If any of the packets are erroneous, they do not get acknowledged by the receiver, which in turn triggers re-transmission by host/sender. This mechanism is known as PAR (Positive Acknowledgement with Retransmission). Since TCP is slower than UDP, TCP is appropriate for applications that do not require high speed or longer period took for transmission is not a constraint. Regarding error detection and error recovery, UDP works on a best effort basis. This protocol also supports error detection. However, the erroneous packets detected by checksum are discarded. UDP does not attempt to retransmit packets. The reason UDP does not attempt retransmission of packets is that this protocol is commonly used for time-sensitive applications such as voice transmission, gaming, etc. Hence, recovery attempt would be of no point as by the time retransmission takes place, and the packets are received, they will be of no use.