0% found this document useful (0 votes)
23 views10 pages

DC - 4

Uploaded by

akhilbera7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views10 pages

DC - 4

Uploaded by

akhilbera7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Unit – 4

1) UDP CHECKSUM
A) User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the Internet
Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is an unreliable and connectionless
protocol. So, there is no need to establish a connection before data transfer. The UDP helps to
establish low-latency and loss-tolerating connections over the network. The UDP enables process-
to-process communication.
What is User Datagram Protocol?
Though Transmission Control Protocol (TCP) is the dominant transport layer protocol used with
most of the Internet services; provides assured delivery, reliability, and much more but all these
services cost us additional overhead and latency. Here, UDP comes into the picture. For real-time
services like computer gaming, voice or video communication, and live conferences; we need UDP.
Since high performance is needed, UDP permits packets to be dropped instead of processing
delayed packets. There is no error checking in UDP, so it also saves bandwidth.

UDP Header
UDP header is an 8-byte fixed and simple header, while for TCP it may vary from 20 bytes to 60
bytes. The first 8 Bytes contain all necessary header information and the remaining part consists 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.

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.
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.
 User Datagram Protocol (UDP) is more efficient in terms of both latency and
bandwidth.
Disadvantages of UDP
 No reliability: UDP does not guarantee delivery of packets or order of delivery, which
can lead to missing or duplicate data.
 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.
2) TCP segment structure
A) The Transmission Control Protocol is the most common transport layer protocol. It works
together with IP and provides a reliable transport service between processes using the network
layer service provided by the IP protocol.
The various services provided by the TCP to the application layer are as follows:

1. Process-to-Process Communication –
TCP provides a process to process communication, i.e, the transfer of data that takes
place between individual processes executing on end systems. This is done using port
numbers or port addresses. Port numbers are 16 bits long that help identify which
process is sending or receiving data on a host.

2. Stream oriented –
This means that the data is sent and received as a stream of bytes(unlike UDP or IP
that divides the bits into datagrams or packets). However, the network layer, that
provides service for the TCP, sends packets of information not streams of bytes.
Hence, TCP groups a number of bytes together into a segment and adds a header to
each of these segments and then delivers these segments to the network layer. At the
network layer, each of these segments is encapsulated in an IP packet for
transmission. The TCP header has information that is required for control purposes
which will be discussed along with the segment structure.

3. Full-duplex service –
This means that the communication can take place in both directions at the same
time.

4. Connection-oriented service –
Unlike UDP, TCP provides a connection-oriented service. It defines 3 different phases:
 Connection establishment
 Data transfer
 Connection termination
5. Reliability –
TCP is reliable as it uses checksum for error detection, attempts to recover lost or
corrupted packets by re-transmission, acknowledgement policy and timers. It uses
features like byte number and sequence number and acknowledgement number so as
to ensure reliability. Also, it uses congestion control mechanisms.

6. Multiplexing –
TCP does multiplexing and de-multiplexing at the sender and receiver ends
respectively as a number of logical connections can be established between port
numbers over a physical connection.

Byte number, Sequence number and Acknowledgement number:


All the data bytes that are to be transmitted are numbered and the beginning of this numbering is
arbitrary. Sequence numbers are given to the segments so as to reassemble the bytes at the
receiver end even if they arrive in a different order. The sequence number of a segment is the byte
number of the first byte that is being sent. The acknowledgement number is required since TCP
provides full-duplex service. The acknowledgement number is the next byte number that the
receiver expects to receive which also provides acknowledgement for receiving the previous
bytes.
TCP Segment structure –
A TCP segment consists of data bytes to be sent and a header that is added to the data by TCP as
shown:

The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there are no
options, a header is 20 bytes else it can be of upmost 60 bytes.
Header fields:

 Source Port Address –


A 16-bit field that holds the port address of the application that is sending the data
segment.
 Destination Port Address –
A 16-bit field that holds the port address of the application in the host that is receiving
the data segment.

 Sequence Number –
A 32-bit field that holds the sequence number, i.e, the byte number of the first byte
that is sent in that particular segment. It is used to reassemble the message at the
receiving end of the segments that are received out of order.

 Acknowledgement Number –
A 32-bit field that holds the acknowledgement number, i.e, the byte number that the
receiver expects to receive next. It is an acknowledgement for the previous bytes
being received successfully.

 Header Length (HLEN) –


This is a 4-bit field that indicates the length of the TCP header by a number of 4-byte
words in the header, i.e if the header is 20 bytes(min length of TCP header), then this
field will hold 5 (because 5 x 4 = 20) and the maximum length: 60 bytes, then it’ll hold
the value 15(because 15 x 4 = 60). Hence, the value of this field is always between 5
and 15.

 Control flags –
These are 6 1-bit control bits that control connection establishment, connection
termination, connection abortion, flow control, mode of transfer etc. Their function
is:
 URG: Urgent pointer is valid
 ACK: Acknowledgement number is valid( used in case of cumulative
acknowledgement)
 PSH: Request for push
 RST: Reset the connection
 SYN: Synchronize sequence numbers
 FIN: Terminate the connection
 Window size –
This field tells the window size of the sending TCP in bytes.

 Checksum –
This field holds the checksum for error control. It is mandatory in TCP as opposed to
UDP.

 Urgent pointer –
This field (valid only if the URG control flag is set) is used to point to data that is
urgently required that needs to reach the receiving process at the earliest. The value
of this field is added to the sequence number to get the byte number of the last urgent
byte.
3) Go back N
A) Go-Back-N ARQ is mainly a specific instance of Automatic Repeat Request (ARQ) protocol where
the sending process continues to send a number of frames as specified by the window size even
without receiving an acknowledgement(ACK) packet from the receiver.

The sender keeps a copy of each frame until the arrival of acknowledgement.
This protocol is a practical approach to the sliding window.

 In Go-Back-N ARQ, the size of the sender is N and the size of the receiver window is always
1.
 This protocol makes the use of cumulative acknowledgements means here the receiver
maintains an acknowledgement timer; whenever the receiver receives a new frame from the
sender then it starts a new acknowledgement timer. When the timer expires then the
receiver sends the cumulative acknowledgement for all the frames that are
unacknowledged by the receiver at that moment.
 It is important to note that the new acknowledgement timer only starts after the receiving
of a new frame, it does not start after the expiry of the old acknowledgement timer.
 If the receiver receives a corrupted frame, then it silently discards that corrupted frame and
the correct frame is retransmitted by the sender after the timeout timer expires. Thus
receiver silently discards the corrupted frame. By discarding silently we mean that: “Simply
rejecting the frame and not taking any action for the frame".
 In case after the expiry of the acknowledgement timer, suppose there is only one frame that
is left to be acknowledged. In that case, the receiver sends the independent
acknowledgement for that frame.
 In case if the receiver receives the out of order frame then it simply discards all the frames.
 In case if the sender does not receive any acknowledgement then the entire window of the
frame will be retransmitted in that case.
 Using the Go-Back-N ARQ protocol leads to the retransmission of the lost frames after the
expiry of the timeout timer.

The Need of Go-Back-N ARQ

This protocol is used to send more than one frame at a time. With the help of Go-Back-N ARQ, there
is a reduction in the waiting time of the sender.

With the help of the Go-Back-N ARQ protocol the efficiency in the transmission increases.

Send (sliding) window for Go-Back-N ARQ

Basically, the range which is in the concern of the sender is known as the send sliding window for the
Go-Back-N ARQ. It is an imaginary box that covers the sequence numbers of the data frame which
can be in transit.

The size of this imaginary box is 2m-1 having three variables Sf( which indicates send window, the
first outstanding frame), Sn(indicates the send window, the next frame to be sent), SSize.(indicates
the send window, size).

 The sender can transmit N frames before receiving the ACK frame.
 The size of the send sliding window is N.
 The copy of sent data is maintained in the sent buffer of the sender until all the sent packets
are acknowledged.
 If the timeout timer runs out then the sender will resend all the packets.
 Once the data get acknowledged by the receiver then that particular data will be removed
from the buffer.

Whenever a valid acknowledgement arrives then the send window can slide one or more slots.
Sender Window Size

As we have already told you the Sender window size is N.The value of N must be greater than 1.

In case if the value of N is equal to 1 then this protocol becomes a stop-and-wait protocol.

Receive (sliding) window for Go-Back-N ARQ

The range that is in the concern of the receiver is called the receiver sliding window.

 The receive window is mainly an abstract concept of defining an imaginary box whose size is
1and has a single variable Rn.
 The window slides when a correct frame arrives, the sliding occurs one slot at a time.
 The receiver always looks for a specific frame to arrive in the specific order.
 Any frame that arrives out of order at the receiver side will be discarded and thus need to be
resent by the sender.
 If a frame arrives at the receiver safely and in a particular order then the receiver send ACK
back to the sender.
 The silence of the receiver causes the timer of the unacknowledged frame to expire.

Design of Go-Back-N ARQ

With the help of Go-Back-N ARQ, multiple frames can be transit in the forward direction and
multiple acknowledgements can transit in the reverse direction. The idea of this protocol is similar to
the Stop-and-wait ARQ but there is a difference and it is the window of Go-Back-N ARQ allows us to
have multiple frames in the transition as there are many slots in the send window.
Window size for Go-Back-N ARQ

In the Go-Back-N ARQ, the size of the send window must be always less than 2m and the size of the
receiver window is always 1.

Flow Diagram
Advantages:

 The efficiency of this protocol is more.


 The waiting time is pretty much low in this protocol.
 With the help of this protocol, the timer can be set for many frames.
 Also, the sender can send many frames at a time.
 Only one ACK frame can acknowledge more than one frame.

Disadvantages:

 Timeout timer runs at the receiver side only.


 The transmitter needs to store the last N packets.
 The retransmission of many error-free packets follows an erroneous packet.

5) Selective repeat

A) Selective Repeat Protocol (SRP) : This protocol(SRP) is mostly identical to GBN protocol, except
that buffers are used and the receiver, and the sender, each maintains a window of size. SRP
works better when the link is very unreliable. Because in this case, retransmission tends to happen
more frequently, selectively retransmitting frames is more efficient than retransmitting all of
them. SRP also requires full-duplex link. backward acknowledgements are also in progress.
 Sender’s Windows ( Ws) = Receiver’s Windows ( Wr).
 Window size should be less than or equal to half the sequence number in SR protocol.
This is to avoid packets being recognized incorrectly. If the size of the window is
greater than half the sequence number space, then if an ACK is lost, the sender may
send new packets that the receiver believes are retransmissions.
 Sender can transmit new packets as long as their number is with W of all unACKed
packets.
 Sender retransmit un-ACKed packets after a timeout – Or upon a NAK if NAK is
employed.
 Receiver ACKs all correct packets.
 Receiver stores correct packets until they can be delivered in order to the higher layer.
 In Selective Repeat ARQ, the size of the sender and receiver window must be at most
one-half of 2^m.

Figure – the sender only retransmits frames, for which a NAK is receivedEfficiency of Selective
Repeat Protocol (SRP) is same as GO-Back-N’s efficiency :
Efficiency = N/(1+2a)
Where a = Propagation delay / Transmission delay
Buffers = N + N
Sequence number = N(sender side) + N ( Receiver Side)

if Tt(ack) :Transmission delay for acknowledgment , Tq: Queuing delay and Tpro: Processing delay
is mention
We know that the Efficiency (?),
=Useful time / Total cycle time
=Tt(data) /Tt(data) + 2*Tp + Tq + Tpro + Tt(ack)
Tt(data) : Transmission delay for Data packet
Tp : propagation delay for Data packet
Tq: Queuing delay
Tpro: Processing delay
Tt(ack): Transmission delay for acknowledgment
Above formula is applicable for any condition, if any of the things are not given we assume it to be
0.
6) Cause and costs of congestion
A) Network Congestion occurs when the traffic flowing through a network exceeds its maximum
capacity. In most cases, congestion is a temporary issue with the network caused due to a sudden
upsurge of traffic, however, sometimes, a network is continually congested, indicating a deeper
problem. End-users perceive network congestion as Network Slowdown or a very large delay in
processing requests.
Network congestion is also a contributing factor in the following underlying issues:
 High Latency –
In a congested network, the time taken by a packet to reach its destination increases
significantly, hence a higher latency rate is observed.
 Connection timeouts –
Ideally, the service should wait for the arrival of packets but in several cases, the
connection terminates due to timeout.
 Packet loss –
Many packets cannot reach their destination if the network is congested, and will be
dropped eventually due to timeout.
Causes of network congestion :
1. Excessive bandwidth consumption –
Certain users or devices on the network may occasionally utilize more bandwidth than
the average user or device. This can put a strain on the network and its routing
equipment (routers, switches, and cables), causing network congestion.

2. Poor subnet management –


For better resource management, a big network is divided into subnets. However,
network congestion could arise if the subnets are not scaled according to usage
patterns and resource requirements.

3. Broadcast Storms –
A broadcast storm occurs when there is a sudden upsurge in the number of requests
to a network. As a result, a network may be unable to handle all of the requests at the
same time.

4. Multicasting –
Multicasting occurs when a network allows multiple computers to communicate with
each other at the same time. In multicasting, a collision can occur when two packets
are sent at the same time. Such frequent collisions may cause a network to be
congested.

5. Border Gateway Protocol –


All traffic is routed by BGP via the shortest possible path. However, while routing a
packet, it doesn’t consider the amount of traffic present in the route. In such
scenarios, there is a possibility all the packets are being routed via the same route
which may lead to network congestion.

6. Too many devices –


Every network has a limit on the amount of data it can manage. This capacity
establishes a limit on how much bandwidth and traffic your network can handle before
performance degrades. If the network has too many devices linked to it, the network
may become burdened with data requests.

7. Outdated Hardware –
When data is transmitted over old switches, routers, servers, and Internet exchanges,
bottlenecks can emerge. Data transmission can get hampered or slowed down due to
outdated hardware. As a result, network congestion occurs.

8. Over-subscription –
A cost-cutting tactic that can result in the network being compelled to accommodate
far more traffic than it was designed to handle (at the same time).
Effects of network congestion :
1. Queueing delay
2. Packet Loss
3. Slow Network
4. Blocking of new connections
5. Low throughput

You might also like