Assignment 3 Solution

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY

SOFTWARE ENGINEERING DEPARTMENT


SPRING 2022
COMPUTER COMMUNICATION & NETWORKS (SWE-306T)
ASSIGNMENT 3 SOLUTION
Semester: V Batch: 2020
Due Date 20 June 2022 Max Points: 10

Instructions:
 Attempt all questions
 All questions carry equal points

Q1) The following is a dump of a TCP header in hexadecimal format.

05320017 00000001 00000000 500207FF 00000000

a. What is the source port number?


1330
b. What is the destination port number?
23
c. What the sequence number?
1
d. What is the acknowledgment number?
0
e. What is the length of the header?
5 x 4 = 20 Bytes
f. What is the type of the segment?
Telnet (Because Dest. Port is 23)
g. What is the window size?
2047

Q2) The following is a dump of a UDP header in hexadecimal format.

0632000D 001CE217

a. What is the source port number?


1586
b. What is the destination port number?
13
c. What is the total length of the user datagram?
28 Bytes
d. What is the length of the data?
20 Bytes
e. Is the packet directed from a client to a server or vice versa?
Yes (Because of DayTime Process)
f. What is the client process?
DayTime

Q3) TCP connection is using a window size of 10,000 bytes, and the previous acknowledgment number
was 22,001. It receives a segment with acknowledgment number 24,001 and window size advertisement of
12,000. Draw a diagram to show the situation of the window before and after.

Presumptions: window size = 10000 bytes, previous acknowledgement 22001, receives


acknowledgement 24001. The movement of the window can be seen in following figure.
Q4) A window holds bytes 2001 to 5000. The next byte to be sent is 3001. Draw a figure to show the
situation of the window after the following two events.
a. An ACK segment with the acknowledgment number 2500 and window size advertisement 4000 is
received.
b. A segment carrying 1000 bytes is sent.

Q5) TCP Maintains Several Timers. Describe and differentiate the following ones.

a. Connection Establishment Timer


When the server receives a new syn request, it will reply syn+ack to the requester. If it does not receive the
ack from the requester within a certain period of time, the new connection timer will time out and execute
the callback, and retransmit syn+ack. When the timeout exceeds a fixed number of times When the time, the
connection is aborted
b. Retransmission Timer
To retransmit lost segments, TCP uses retransmission timeout (RTO). When TCP sends a segment the timer
starts and stops when the acknowledgment is received. If the timer expires timeout occurs and the segment
is retransmitted. RTO (retransmission timeout is for 1 RTT) to calculate retransmission timeout we first need
to calculate the RTT(round trip time).
RTT three types –
Measured RTT(RTTm) – The measured round-trip time for a segment is the time required for the segment to
reach the destination and be acknowledged, although the acknowledgement may include other segments.
Smoothed RTT(RTTs) – It is the weighted average of RTTm. RTTm is likely to change and its fluctuation is so
high that a single measurement cannot be used to calculate RTO.
Deviated RTT(RTTd) – Most implementations do not use RTTs alone so RTT deviated is also calculated to find
out RTO.
c. Delayed ACK Timer
Data received on a TCP socket has to be acknowledged, either by piggybacking the acknowledgment (ACK)
on an outbound data message, or by sending a stand-alone ACK if no outbound data exists for a period of
time. The TCP delayed acknowledgment timer allows you to adjust, on a per-socket basis, how long the z/TPF
(z/Transaction Processing Facility) system waits before sending a stand-alone ACK to acknowledge data on a
TCP socket.
d. Persistence Timer
To deal with a zero-window-size deadlock situation, TCP uses a persistence timer. When the sending TCP
receives an acknowledgment with a window size of zero, it starts a persistence timer. When the persistence
timer goes off, the sending TCP sends a special segment called a probe. This segment contains only 1 byte of
new data. It has a sequence number, but its sequence number is never acknowledged; it is even ignored in
calculating the sequence number for the rest of the data. The probe causes the receiving TCP to resend the
acknowledgment which was lost.
e. The Keepalive Timer and Idle Timer
A keepalive timer is used to prevent a long idle connection between two TCPs. If a client opens a TCP
connection to a server transfers some data and becomes silent the client will crash. In this case, the
connection remains open forever. So a keepalive timer is used. Each time the server hears from a client, it
resets this timer. The time-out is usually 2 hours. If the server does not hear from the client after 2 hours, it
sends a probe segment. If there is no response after 10 probes, each of which is 75 s apart, it assumes that
the client is down and terminates the connection.
f. The Quiet Timer
The quiet timer is usually set to twice the maximum segment lifetime (the same value as the Time-To-Live
field in an IP header), ensuring that all segments still heading for the port have been discarded.

You might also like