0% found this document useful (0 votes)
104 views11 pages

Ch.4 Transport Layer Protocol 18m

Uploaded by

danepratik4
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)
104 views11 pages

Ch.4 Transport Layer Protocol 18m

Uploaded by

danepratik4
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/ 11

CH.

4 TRANSPORT LAYER PROTOCOL 18M


W-2019
Q.1 State the use of 6 flags in TCP header. 2M W19
Q.2 List two advantages of using UDP over TCP. 2M W 19
Q.3 Compare TCP and UDP (any four points).4M W19
Q.4 The dump of a UDP header in hexadecimal format is as follows: 4M W19
BC 82000 D 002 B 001 D
Obtain the following from it:
(i) Source port number (ii) Destination port number
(iii) Total length (iv) Length of the data
Q.5Explain the TCP connection establishment using a three way handshake mechanism.
4M W19
Q.6 Explain how TCP connections are established using the 3 way handshake. What
happens when 2 hosts simultaneously try to establish a connection? 6M W 19
Q.7 Explain TCP connection management with the help of TCP connection management
finite state machine. 6M W19
W-2023
Q.8 List any 2 features of TCP. 2M W23
Q.9 Enlist any two services offered by UDP. 2M W 23
Q.10 The dump of a UDP header in hexadecimal format is as follows: 4M W23
BC82D00D002B001D
Obtain the following:
(i) Source port number (ii) Destination port number
(iii) Total length (iv) Packet direction
Q.11 Compare TCP with UDP on any four points. 4M W23
Q.12 Explain how TCP connections are established using 3 way handshake. 6M W23
Q.13 Demonstrate with suitable example of call collision in TCP connection. 6M W23
W-2022
Q.14 What is UDP? Which services are provided by UDP (Any two)? 2M W 22
Q.15 Describe flow control under SCTP. 4M W22
Q.16 Draw and explain TCP segment structure. 4M W22
Q.17 List different timers used in TCP. 4M W 22
Q.18 State the need for
1. Sequence Control
2. Error Control
3. Flow Control in Networking 6M W22
4.1 UDP
Q.2 List two advantages of using UDP over TCP. 2M W 19
Advantages of using UDP over TCP:
1) UDP is connection less and unreliable transport layer protocol.
i.e. It does not require to maintain a connection.
2) UDP is transaction oriented and suitable for simple query
response protocols.
3) UDP is faster since it does not require acknowledgment.
4) Useful when time sensitivity is more important

Q.4 The dump of a UDP header in hexadecimal format is as follows: 4M W19


BC 82000 D 002 B 001 D
Obtain the following from it:
(i) Source port number (ii) Destination port number
(iii) Total length (iv) Length of the data
The UDP header has four parts, each of two bytes.
That means we get the following interpretation of the header.
i) Source port number = BC8216 = 48258
ii) Destination port number = 000D16= 13
iii) Total length = 002B16 = 43 bytes
iv) Since the header is 8 bytes the data length is 43 − 8 =35 bytes.

Q.9 Enlist any two services offered by UDP. 2M W 23


1) Process to Process communication
2) Connectionless Service
3) Flow control
4) Error control
5) Checksum

Q.10 The dump of a UDP header in hexadecimal format is as follows: 4M W23


BC82D00D002B001D
Obtain the following:
(i) Source port number (ii) Destination port number
(iii) Total length (iv) Packet direction
Considering hexadecimal format as:
BC82D00D002B001D
The UDP header has four parts, each of two bytes.
That means we get the following interpretation of the header.
i) Source port number = BC8216 = 48258
ii) Destination port number = D00D16= 53261
iii) Total length = 002B16 = 43 bytes
iv) Packet direction: The provided dump does not contain information about the packet
direction. The UDP header alone does not specify the direction.
Q.14 What is UDP? Which services are provided by UDP (Any two)? 2M W 22
UDP(User Datagram Protocol): UDP is a simple, datagram-oriented, transport layer protocol. It
involves a minimum amount of communication mechanisms. It is a connectionless, reliable
protocol. UDP Services:
1. Process-to-Process Communication: - UDP provides process-to-process communication using
socket addresses, a combination of IP addresses and port numbers.
2. Connectionless Service: - UDP provides a connectionless service, i.e. each user datagram sent by
UDP is an independent datagram.
3. UDP provides no flow control.
4. UDP does not provides no error control.
5. UDP does not provide congestion control.
6. UDP protocol encapsulates and decapsulates messages.

4.2 TCP
Q.5Explain the TCP connection establishment using a three way handshake mechanism.
4M W19
Q.6 Explain how TCP connections are established using the 3 way handshake. What
happens when 2 hosts simultaneously try to establish a connection? 6M W 19
Q.12 Explain how TCP connections are established using 3 way handshake. 6M W23
Connection Establishment
TCP uses a Three way handshaking mechanism to establish a connection between client and
server machines.
The three steps in three way handshaking mechanism are as follows.
SYN:
The client sends the first segment, a SYN segment, in which only the SYN flag is set. This
segment is for synchronization of sequence numbers.
SYN + ACK
The server sends the second segment, a SYN +ACK segment, with 2 flag bits set.
ACK
The client sends the third segment. This is just an ACK segment. It guarantees the completion
of three way handshaking.

If 2 host Simultaneously try to establish connection:


Simultaneous Open:
It's possible for two applications to send a SYN to each other to start a TCP connection,
although the possibility is small, because both sides have to know which port on the other side
to send to.
This process is called "Simultaneous Open", or "simultaneous active open on both sides".
In a simultaneous open, both applications issue active opens.
This is a rare situation in which there is no client or server; communication is between two
peers that know their local port numbers.
Both TCPs go through SYN-SENT and SYN-RCVD states
before going to the ESTABLISHED state.
Both processes act as client and server.
The two SYN+ACK segments acknowledge the SYN segments and open the connection.
OR
Simultaneous Close:
It's permitted in TCP for both sides to do "active close", which is called "Simultaneous
Close". During "Simultaneous Close", 4 packets are exchanged, the same as in normal
situations.
In this situation, both ends issue an active close.
Both TCPs go to the FIN-WAIT-1 state and send FIN segments that are in transit
simultaneously.
After receiving the FIN segment, each end goes to the CLOSING state and sends an ACK
segment.
The CLOSING state takes the place of FIN-WAIT-2 or CLOSEWAIT in a common scenario.

Q.3 Compare TCP and UDP (any four points).4M W19


Q.11 Compare TCP with UDP on any four points. 4M W23
Q.8 List any 2 features of TCP. 2M W23
Any 2 Correct Features 1 M each

1) Connection Oriented Protocol


2) Reliable
3) Congestion Control
4) Full Duplex
5) Error Control and Recovery
6) Flow Control

Q.13 Demonstrate with suitable example of call collision in TCP connection. 6M W23
The connection is established in TCP using the three-way handshake as discussed earlier
to create a connection.

One side, say the server, passively stays for an incoming link by implementing the LISTEN
and ACCEPT primitives, either determining a particular other side or nobody in particular.

The other side performs a connect primitive specifying the I/O port to which it wants to join.
The maximum TCP segment size available, other options are optionally like some private data
(example password).

The CONNECT primitive transmits a TCP segment with the SYN bit on and the ACK bit off
and waits for a response.
The sequence of TCP segments sent in the typical case, as shown in the figure below –

When the segment sent by Host-1 reaches the destination, i.e., host -2, the receiving server
checks to see if there is a process that has done a LISTEN on the port given in the
destination port field. If not, it sends a response with the RST bit on to refuse the connection.

Otherwise, it governs the TCP segment to the listing process, which can accept or decline (for
example, if it does not look similar to the client) the connection.

Call Collision: If two hosts try to establish a connection simultaneously between the same
two sockets, then the events sequence is demonstrated in the figure under such circumstances.
Only one connection is established. It cannot select both the links because their endpoints
identify connections.

Suppose the first set up results in a connection identified by (x, y) and the second connection
are also released up.

In that case, only tail enter will be made, i.e., for (x, y) for the initial sequence number, a
clock-based scheme is used, with a clock pulse coming after every 4 microseconds.

For ensuring additional safety when a host crashes, it may not reboot for sec, which is the
maximum packet lifetime. This is to make sure that no packets from previous connections are
roaming around.

Q.7 Explain TCP connection management with the help of TCP connection management
finite state machine. 6M W19
(Note: Any other explanation of the concept shall be considered).

To keep track of all the different events happening during connection establishment,
connection termination, and data transfer,
TCP is specified as the Finite State Machine –FSM
TCP State Machine:
TCP uses a three way handshake to close connection
Singled by the FIN bit in the packet header
The figure shows the two FSMs used by the TCP client and server combined in one diagram.
Ovals/rectangle represents states.
Transition from one state to another is shown using directed lines.
Each line has two strings separated by a slash.
The first string is the input, what TCP receives.
The second is the output, what TCP sends.
The dotted black lines in the figure represent the transition that a server normally goes
through;
The solid black lines show the transitions that a client normally goes through.
Sometimes in some situations, a server transitions through a solid line or a client transitions
through a dotted line.

Q.16 Draw and explain TCP segment structure. 4M W22


TCP is a reliable connection- oriented protocol i.e., connection is established between the sender
and receiver before the data can be transmitted.
A Packet in TCP is called a segment.
TCP segment consists of data bytes to be sent and a header that is added to the data by TCP as
shown in following figure.

The header of TCP segment can range from 20-60 bytes.40 bytes are for option. if there are no
options, header is of 20 bytes else it can be of upmost 60 bytes.

Header Fields in TCP Segment Structure:


1) Source port address: - This is a 16-bit field that defines the port number of the application
program in the host that is sending the segment. This serves the same purpose as the source port
address in the UDP header.

2) Destination port address: - This is a 16-bit field that defines the port number of the application
program in the host that is receiving the segment. This serves the same purpose as the destination
port address in the UDP header.

3) Sequence Number: - This 32-bit field defines the number assigned to the first byte of data
contained in this segment. As we said before, TCP is a stream transport protocol. To ensure
connectivity, each byte to be transmitted is numbered. The sequence number tells the destination
which byte in this sequence comprises the first byte in the segment. During connection
establishment, each party uses a random number generator to create an initial sequence number
(ISN), which is usually different in each direction.

4) Acknowledgment Number: - This 32-bit field defines the byte number that the receiver of the
segment is expecting to receive from the other party. If the receiver of the segment has successfully
received byte number x from the other party, it defines x + 1 as the acknowledgment number.
Acknowledgment and data can be piggybacked together.

5) Header length: - This 4-bit field indicates the number of 4-byte words in the TCP header. The
length of the header can be between 20 and 60 bytes. Therefore, the value of this field can be
between 5 (5 x 4 = 20) and 15 (15 x 4 = 60).

6) Reserved:- This is a 6-bit field reserved for future use.

7) Control Field:- This field defines 6 different control bits or flags. These are 6, 1 bit control bits
that controls connection establishment, connection termination, connection abortion, flow control,
mode of transfer etc.

The function of control fields in TCP are:


URG: Urgent pointer is valid.
ACK: Acknowledgement : If this bit field is set the ACK field described earlier is valid.
PSH: Request for push.
RST: Reset the connection.
SYN: Synchronize sequence numbers.
FIN: Terminate the connection.

8) Window Size: This field tells the window size of the sending TCP in bytes.

9) Checksum: This field holds the checksum for error control. It is mandatory in TCP as opposed
to UDP.

10) Urgent Pointer: This field (valid only if the URG control flag is set) 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.

11) Options: There can be up to 40 bytes of optional information in the TCP header.

Q.1 State the use of 6 flags in TCP header. 2M W19


There are 6, 1-bit control bits that control connection establishment, termination, abortion, flow
control etc..

URG ACK PSH RST SYN FIN

1) URG: Urgent pointer


If this bit field is set the receiving TCP should interpret the urgent pointer field.
2) ACK: Acknowledgement
If this bit field is set the ACK field described earlier is valid.
3) PSH: Push function
Request for push
4) RST: Reset the connection
If this bit is present it signals the receiver that sender is aborting the connection i.e. Reset the
connection.
5) SYN: Synchronize
When this bit field in present then the sender is attempting to synchronize sequence numbers.
6) FIN: No more data from sender. If this bit is set then it terminates the connection.

OR

Q.17 List different timers used in TCP. 4M W 22


TCP uses several timers to ensure that excessive delays are not encountered during
communications.
Several of these timers are elegant, handling problems that are not immediately obvious at first
analysis.
Each of the timers used by TCP is examined in the following subsections, which reveal its role in
ensuring data is properly sent from one connection to another.
TCP implementations use at least four timers as shown in following Fig.

1) Retransmission Timer: To retransmit lost segments, TCP uses Retransmission Time Out
(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.

2) Persistent 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.
3) Keepalive 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 keep alive 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.
4) Time Wait Timer:
This timer is used during TCP connection termination. The timer starts after sending the last Ack
for 2nd FIN and closing the connection.

After a TCP connection is closed, it is possible for datagrams that are still making their way
through the network to attempt to access the closed port.

The quiet timer is intended to prevent the just closed port from reopening again quickly and
receiving these last datagrams. 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.

Q.18 State the need for


1. Sequence Control
2. Error Control
3. Flow Control in Networking 6M W22

Sequence Control The 32-bit sequence number field defines the number assigned to the first byte
of data contained in this segment.

TCP is a stream transport protocol. To ensure connectivity, each byte to be transmitted is


numbered. The sequence number tells the destination which byte in this sequence comprises the
first byte in the segment.

During connection establishment, each party uses a Random number generator to create an initial
sequence number (ISN), which is usually different in each direction. We know that a TCP sequence
number is 32 bit. So it has finite (from 0 to (232-1) = 4 Giga sequence numbers) and it means we
will be able to send only 4GB of data with a unique sequence number not more than that.

It helps with the allocation of a sequence number that does not conflict with other data bytes
transmitted over a TCP connection. An ISN is unique to each connection and separated by each
device.

Error Control Error Control mechanisms are useful to ensure reliability service of TCP.
To provide reliable service TCP detects and corrects errors.

Error control mechanisms are useful for detecting corrupted segments, lost segments, out-of-order
segments, and duplicated segments.
Error detection and correction in TCP is achieved through the use of three simple tools: checksum,
acknowledgment, and time-out.

Flow Control Flow control make it possible for sender to send the amount of data bytes that can be
sent without worrying an acknowledgment and is one of the most important duties of the data link
layer.
In most protocols, flow control is a set of procedures that tells the sender how much data it can
transmit before it must wait for an acknowledgment from the receiver.
The flow Control procedures not allowed to overwhelm the receiver.

Any receiving device has a limited speed at which it can process incoming data and a limited
amount of memory in which to store incoming data, if sender sends data in a much speed data loss
may occur to overcome this problem flow control procedures are needful.

4.3 SCTP
Q.15 Describe flow control under SCTP. 4M W22
(Any other relevant explanation or example can be considered)
Flow control under SCTP Flow control in SCTP is similar to that in TCP. Like TCP, SCTP
executes flow control to prevent overwhelming the receiver.
In SCTP, we need to handle two units of data, the byte and the chunk.
The values of rwnd and cwnd are expressed in bytes; the values of TSN and acknowledgments are
expressed in chunks. Current SCTP implementations still use a byte-oriented window for flow
control.
Receiver Site: The receiver has one buffer (queue) and three variables. The queue holds the
received data chunks that have not yet been read by the process. The first variable holds the last
TSN received,cumTSN. The second variable holds the available buffer size; winsize. The third
variable holds the last accumulative acknowledgment, lastACK. The following figure shows the
queue and variables at the receiver site.

1. When the site receives a data chunk, it stores it at the end of the buffer (queue) and subtracts the
size of the chunk from winSize. The TSN number of the chunk is stored in the cumTSN variable.
2. When the process reads a chunk, it removes it from the queue and adds the size of the removed
chunk to winSize (recycling).
3. When the receiver decides to send a SACK, it checks the value of lastAck; if it is less than
cumTSN, it sends a SACK with a cumulative TSN number equal to the cumTSN. It also includes
the value of winSize as the advertised window size.

Sender Site: The sender has one buffer (queue) and three variables: curTSN, rwnd, and inTransit,
as shown in the following figure.
We assume each chunk is 100 bytes long. The buffer holds the chunks produced by the process that
either have been sent or are ready to be sent.
The first variable, curTSN, refers to the next chunk to be sent. All chunks in the queue with a TSN
less than this value have been sent, but not acknowledged; they are outstanding.
The second variable, rwnd, holds the last value advertised by the receiver (in bytes).
The third variable, inTransit, holds the number of bytes in transit, bytes sent but not yet
acknowledged. The following is the procedure used by the sender.

You might also like