Final Assignment Computer Networks
Final Assignment Computer Networks
Final Assignment Computer Networks
Networks
Group Assignment
Transport layer:
The transport layer is one of the seven layers in the OSI (Open Systems
Interconnection) model of networking.
The transport layer is the fourth layer in the OSI model, situated above the network layer
and below the session layer. It acts as a bridge between the application layer (where user-level
processes and applications reside) and the network layer (which handles the routing and
forwarding of data packets). The primary functions of the transport layer include:
1) Segmentation and reassembly: The transport layer takes data from the application layer
and breaks it into smaller units called segments. These segments are then transmitted over
the network. On the receiving end, the transport layer reassembles these segments into the
original data.
2) End-to-End communication: It ensures reliable end-to-end communication between two
devices. This means that data sent from one device should reach the other device intact and
in the correct order, even if multiple intermediate devices are involved.
3) Flow control: The transport layer manages flow control, which regulates the rate of data
transmission to prevent congestion and ensure efficient data transfer.
4) Error detection and correction: Some transport layer protocols, like TCP (Transmission
Control Protocol), include mechanisms for detecting and correcting errors in transmitted
data.
In short, the transport layer plays a crucial role in network communication by segmenting,
managing, and ensuring the reliable delivery of data between devices on a network while
providing services like flow control, error detection, and port-based multiplexing.
It ensures data integrity and reliability by managing data segmentation, flow control, and
error correction.
It supports a variety of communication patterns, including point-to-point and multipoint
communication.
The transport layer uses various protocols to perform its functions. TCP and UDP are two of the
most well-known transport layer protocols:
Transport Layer Page # 3
In summary, the transport layer plays a vital role in ensuring reliable communication between
devices in a network. It provides essential services for data segmentation, error handling, and
flow control, but the choice of transport layer protocol (TCP or UDP) depends on the specific
requirements of the application being used
Internet Transport layer:
The Internet transport layer, also known as the transport layer, is the fourth layer in the OSI (Open
Systems Interconnection) model and the TCP/IP (Transmission Control Protocol/Internet
Protocol) protocol suite. Its primary function is to ensure end-to-end communication, reliability,
and data integrity between devices on a network. The transport layer accomplishes this by
managing the segmenting, encapsulation, and reassembly of data during transmission.
Protocols:
Two main and important protocols are:
1. TCP (Transmission Control Protocol)
2. UDP (User Datagram Protocol)
TCP (Transmission Control Protocol):
It is a connection-oriented protocol for communications that helps in the exchange
of messages between different devices over a network. The Internet Protocol (IP), which
establishes the technique for sending data packets between computers, works with TCP.
Transport Layer Page # 4
Working of TCP:
To make sure that each message reaches its target location intact, the TCP/IP model
breaks down the data into small bundles and afterward reassembles the bundles into the original
message on the opposite end. Sending the information in little bundles of information makes it
simpler to maintain efficiency as opposed to sending everything in one go.
After a particular message is broken down into bundles, these bundles may travel along multiple
routes if one route is jammed but the destination remains the same.
Figure 1
For example, When a user requests a web page on the internet, somewhere in the world, the
server processes that request and sends back an HTML Page to that user. The server makes use of
a protocol called the HTTP Protocol. The HTTP then requests the TCP layer to set the required
connection and send the HTML file.
Now, the TCP breaks the data into small packets and forwards it toward the Internet
Protocol (IP) layer. The packets are then sent to the destination through different routes.
The TCP layer in the user’s system waits for the transmission to get finished and
acknowledges once all packets have been received.
Features of TCP/IP:
Some of the most prominent features of Transmission control protocol are
1) Segment Numbering System: TCP keeps track of the segments being transmitted or
received by assigning numbers to each and every single one of them.A specific Byte
Number is assigned to data bytes that are to be transferred while segments are assigned
sequence numbers. Acknowledgment Numbers are assigned to received segments.
2) Connection Oriented: It means sender and receiver are connected to each other till the
completion of the process. The order of the data is maintained i.e. order remains same
before and after transmission.
Transport Layer Page # 5
3) Full Duplex: In TCP data can be transmitted from receiver to the sender or vice – versa at
the same time. It increases efficiency of data…
Figure 2
TCP Header:
TCP (Transmission Control Protocol) is a reliable transport protocol as it establishes a
connection before sending any data and everything that it sends is acknowledged by the receiver.
In this lesson we will take a closer look at the TCP header and its different fields. Here’s what it
looks like:
Transport Layer Page # 6
Figure 3
Let’s walk through all these fields:
Source port: This is a 16 bit field that specifies the port number of the sender.
Destination port: This is a 16 bit field that specifies the port number of the receiver.
Sequence number: the sequence number is a 32 bit field that indicates how much data is
sent during the TCP session. When you establish a new TCP connection (3 way handshake)
then the initial sequence number is a random 32 bit value. The receiver will use this
sequence number and sends back an acknowledgment. Protocol analyzers like wireshark
will often use a relative sequence number of 0 since it’s easier to read than some high
random number.
Acknowledgment number: This 32 bit field is used by the receiver to request the next
TCP segment. This value will be the sequence number incremented by 1.
DO: This is the 4 bit data offset field, also known as the header length. It indicates the
length of the TCP header so that we know where the actual data begins.
RSV: These are 3 bits for the reserved field. They are unused and are always set to 0.
Flags: There are 9 bits for flags, we also call them control bits. We use them to establish
connections, send data and terminate connections:
URG: Urgent pointer. When this bit is set, the data should be treated as priority over other
data.
ACK: Used for the acknowledgment.
PSH: This is the push function. This tells an application that the data should be transmitted
immediately and that we don’t want to wait to fill the entire TCP segment.
RST: this resets the connection, when you receive this you have to terminate the connection
right away. This is only used when there are unrecoverable errors and it’s not a normal way
to finish the TCP connection.
SYN: we use this for the initial three way handshake and it’s used to set the initial
sequence number.
Transport Layer Page # 7
FIN: This finish bit is used to end the TCP connection. TCP is full duplex so both parties
will have to use the FIN bit to end the connection. This is the normal method how we end
an connection.
Window: The 16 bit window field specifies how many bytes the receiver is willing to
receive. It is used so the receiver can tell the sender that it would like to receive more
data than what it is currently receiving. It does so by specifying the number of bytes
beyond the sequence number in the acknowledgment field.
Checksum: 16 bits are used for a checksum to check if the TCP header is OK or not.
Urgent pointer: These 16 bits are used when the URG bit has been set, the urgent
pointer is used to indicate where the urgent data ends.
Options: This field is optional and can be anywhere between 0 and 320 bits.
Figure 4
Transport Layer Page # 8
UDP Header:
UDP header is an 8-bytes fixed and simple header, while for TCP it may vary from 20
bytes to 60 bytes. The first 8 Bytes contains all necessary header information and the
remaining part consist of data. UDP port number fields are each 16 bits long, therefore the
range for port numbers is defined from 0 to 65535; port number 0 is reserved. Port numbers
help to distinguish different user requests or processes.
Figure 5
1) Source Port: Source Port is a 2 Byte long field used to identify the port number of the
source.
2) Destination Port: It is a 2 Byte long field, used to identify the port of the destined
packet.
3) Length: Length is the length of UDP including the header and the data. It is a 16-bits
field.
4) Checksum: Checksum is 2 Bytes long field. It is the 16-bit one’s complement of the
one’s complement sum of the UDP header, the pseudo-header of information from the
IP header, and the data, padded with zero octets at the end (if necessary) to make a
multiple of two octets.
Notes – Unlike TCP, the Checksum calculation is not mandatory in UDP. No Error control or
flow control is provided by UDP. Hence UDP depends on IP and ICMP for error
reporting. Also UDP provides port numbers so that is can differentiate between users requests.
Applications of UDP:
Used for simple request-response communication when the size of data is less and
hence there is lesser concern about flow and error control.
It is a suitable protocol for multicasting as UDP supports packet switching.
UDP is used for some routing update protocols like RIP(Routing Information Protocol).
Normally used for real-time applications which can not tolerate uneven delays between
sections of a received message.
UDP is widely used in online gaming, where low latency and high-speed
communication is essential for a good gaming experience. Game servers often send
small, frequent packets of data to clients, and UDP is well suited for this type of
communication as it is fast and lightweight.
Transport Layer Page # 9
Streaming media applications, such as IPTV, online radio, and video conferencing, use
UDP to transmit real-time audio and video data. The loss of some packets can be
tolerated in these applications, as the data is continuously flowing and does not require
retransmission.
VoIP (Voice over Internet Protocol) services, such as Skype and WhatsApp, use UDP
for real-time voice communication. The delay in voice communication can be
noticeable if packets are delayed due to congestion control, so UDP is used to ensure
fast and efficient data transmission.
DNS (Domain Name System) also uses UDP for its query/response messages. DNS
queries are typically small and require a quick response time, making UDP a suitable
protocol for this application.
DHCP (Dynamic Host Configuration Protocol) uses UDP to dynamically assign IP
addresses to devices on a network. DHCP messages are typically small, and the delay
caused by packet loss or retransmission is generally not critical for this application.
Following implementations uses UDP as a transport layer protocol:
o NTP (Network Time Protocol)
o DNS (Domain Name Service)
o BOOTP, DHCP.
o NNP (Network News Protocol)
o Quote of the day protocol
o TFTP, RTSP, RIP.
The application layer can do some of the tasks through UDP-
o Trace Route
o Record Route
o Timestamp
UDP takes a datagram from Network Layer, attaches its header, and sends it to the user.
So, it works fast.
Actually, UDP is a null protocol if you remove the checksum field.
o Reduce the requirement of computer resources.
o When using the Multicast or Broadcast to transfer.
o The transmission of Real-time packets, mainly in multimedia applications.
Advantages of UDP:
Speed: UDP is faster than TCP because it does not have the overhead of establishing
a connection and ensuring reliable data delivery.
Lower latency: Since there is no connection establishment, there is lower latency and
faster response time.
Simplicity: UDP has a simpler protocol design than TCP, making it easier to
implement and manage.
Broadcast support: UDP supports broadcasting to multiple recipients, making it
useful for applications such as video streaming and online gaming.
Smaller packet size: UDP uses smaller packet sizes than TCP, which can reduce
network congestion and improve overall network performance.
Disadvantages of UDP:
No reliability: UDP does not guarantee delivery of packets or order of delivery,
which can lead to missing or duplicate data.
Transport Layer Page # 10
No congestion control: UDP does not have congestion control, which means that it
can send packets at a rate that can cause network congestion.
No flow control: UDP does not have flow control, which means that it can
overwhelm the receiver with packets that it cannot handle.
Vulnerable to attacks: UDP is vulnerable to denial-of-service attacks, where an
attacker can flood a network with UDP packets, overwhelming the network and
causing it to crash.
Limited use cases: UDP is not suitable for applications that require reliable data
delivery, such as email or file transfers, and is better suited for applications that can
tolerate some data loss, such as video streaming or online gaming.
Error checking TCP provides extensive error- UDP has only the basic error-
mechanism checking mechanisms. checking mechanism using
checksums.
It is because it provides flow
control and acknowledgment of
data.