Q1.
) TCP Congestion control
TCP uses a congestion window and a congestion policy that avoid congestion.
Previously, we assumed that only the receiver can dictate the sender’s window
size. We ignored another entity here, the network. If the network cannot deliver
the data as fast as it is created by the sender, it must tell the sender to slow
down. In other words, in addition to the receiver, the network is a second entity
that determines the size of the sender’s window.
Congestion policy in TCP –
1. Slow Start Phase: starts slowly increment is exponential to threshold
2. Congestion Avoidance Phase: After reaching the threshold increment
is by 1
3. Congestion Detection Phase: Sender goes back to Slow start phase or
Congestion avoidance phase.
Slow Start Phase : exponential increment – In this phase after every RTT the
congestion window size increments exponentially.
Initially cwnd = 1
After 1 RTT, cwnd = 2^(1) = 2
2 RTT, cwnd = 2^(2) = 4
3 RTT, cwnd = 2^(3) = 8
Congestion Avoidance Phase : additive increment – This phase starts after
the threshold value also denoted as ssthresh. The size of cwnd(congestion
window) increases additive. After each RTT cwnd = cwnd + 1.
Initially cwnd = i
After 1 RTT, cwnd = i+1
2 RTT, cwnd = i+2
3 RTT, cwnd = i+3
Congestion Detection Phase : multiplicative decrement – If congestion
occurs, the congestion window size is decreased. The only way a sender can
guess that congestion has occurred is the need to retransmit a segment.
Retransmission is needed to recover a missing packet that is assumed to have
been dropped by a router due to congestion. Retransmission can occur in one
of two cases: when the RTO timer times out or when three duplicate ACKs are
received.
• Case 1 : Retransmission due to Timeout – In this case congestion
possibility is high.
(a) ssthresh is reduced to half of the current window size.
(b) set cwnd = 1
(c) start with slow start phase again.
• Case 2 : Retransmission due to 3 Acknowledgement Duplicates
– In this case congestion possibility is less.
(a) ssthresh value reduces to half of the current window size.
(b) set cwnd= ssthresh
(c) start with congestion avoidance phase
Q2.) Draw and explain each field in the TCP Segment header.
Every TCP segment consists of a 20 byte fixed format header. Header
options may follow the fixed header. With a header so that it can tag up to
65535 data bytes.
The TCP header format is shown in the figure below −
Source Port, Destination Port : Identify local end points of the connections
Sequence number: Specifies the sequence number of the segment
Acknowledgement Number: Specifies the next byte expected.
TCP header length: Tells how many 32-bit words are contained in TCP header
URG: It is set to 1 if URGENT pointer is in use, which indicates start of urgent data.
ACK: It is set to 1 to indicate that the acknowledgement number is valid.
PSH: Indicates pushed data
RST: It is used to reset a connection that has become confused due to reject an
invalid segment or refuse an attempt to open a connection.
FIN: Used to release a connection.
SYN: Used to establish connections.
CheckSum: A Checksum is also provided for extra reliability
Q3.) HTTP AND MESSAGE FORMATS
o HTTP stands for HyperText Transfer Protocol.
o It is a protocol used to access the data on the World Wide Web (www).
o The HTTP protocol can be used to transfer the data in the form of plain
text, hypertext, audio, video, and so on.
o This protocol is known as HyperText Transfer Protocol because of its
efficiency that allows us to use in a hypertext environment where there
are rapid jumps from one document to another document.
Messages
HTTP messages are of two types: request and response. Both the message
types follow the same message format.
Request Message: The request message is sent by the client that consists
of a request line, headers, and sometimes a body.
Response Message: The response message is sent by the server to the
client that consists of a status line, headers, and sometimes a body.
Q4.) TELNET
Introduction to TELNET
TELNET stands for TErminaLNETwork. It is a type of protocol that enables one computer
to connect to local computer.
It is a used as a standard TCP/IPprotocol for virtual terminal service which is given by
ISO.
Computer which starts connection known as the local computer.
Computer which is being connected to i.e. which accepts the connection known as
remote computer.
TELNET Commands :
Commands of the telnet are identified by a prefix character, Interpret As
Command (IAC) which is having code 255. IAC is followed by command and
option codes.
Modes of Operation :
Most telnet implementation operates in one of the following three modes :
Default mode
Character mode
Line mode
Default Mode :
• If there is no other modes are invoked then this mode is used.
• Echoing is performed in this mode by client.
• In this mode, user types a character and client echoes the character
on the screen but it does not send it until whole line is completed.
Character Mode :
• Each character typed in this mode is sent by client to server.
• Server in this type of mode is normally echoes character back to be
displayed on the client’s screen.
Line Mode :
• Line editing like echoing, character erasing etc. is done from the client
side.
• Client will send the whole line to the server.
Q5.)
Q6) TCP CONNECTION ESTABLISHMENT
TCP is a connection-oriented protocol and every connection-oriented
protocol needs to establish a connection in order to reserve resources at
both the communicating ends.
Connection Establishment –
1. Sender starts the process with the following:
• Sequence number (Seq=521): contains the random initial
sequence number generated at the sender side.
• Syn flag (Syn=1): request the receiver to synchronize its
sequence number with the above-provided sequence number.
• Maximum segment size (MSS=1460 B): sender tells its
maximum segment size, so that receiver sends datagram which
won’t require any fragmentation. MSS field is present
inside Option field in TCP header.
• Window size (window=14600 B): sender tells about his buffer
capacity in which he has to store messages from the receiver.
2. TCP is a full-duplex protocol so both sender and receiver require a
window for receiving messages from one another.
• Sequence number (Seq=2000): contains the random initial
sequence number generated at the receiver side.
• Syn flag (Syn=1): request the sender to synchronize its
sequence number with the above-provided sequence number.
• Maximum segment size (MSS=500 B): sender tells its maximum
segment size, so that receiver sends datagram which won’t
require any fragmentation. MSS field is present
inside Option field in TCP header.
Since MSSreceiver < MSSsender, both parties agree for minimum MSS
i.e., 500 B to avoid fragmentation of packets at both ends.
Therefore, receiver can send maximum of 14600/500 = 29 packets.
This is the receiver's sending window size.
• Window size (window=10000 B): receiver tells about his buffer
capacity in which he has to store messages from the sender.
Therefore, sender can send a maximum of 10000/500 = 20 packets.
This is the sender's sending window size.
• Acknowledgement Number (Ack no.=522): Since sequence
number 521 is received by the receiver so, it makes a request for
the next sequence number with Ack no.=522 which is the next
packet expected by the receiver since Syn flag consumes 1
sequence no.
• ACK flag (ACk=1): tells that the acknowledgement number field
contains the next sequence expected by the receiver.
3. Sender makes the final reply for connection establishment in the
following way:
• Sequence number (Seq=522): since sequence number = 521 in
1st step and SYN flag consumes one sequence number hence,
the next sequence number will be 522.
• Acknowledgement Number (Ack no.=2001): since the sender
is acknowledging SYN=1 packet from the receiver with sequence
number 2000 so, the next sequence number expected is 2001.
• ACK flag (ACK=1): tells that the acknowledgement number field
contains the next sequence expected by the sender.
Since the connection establishment phase of TCP makes use of 3
packets, it is also known as 3-way Handshaking (SYN, SYN + ACK,
ACK).
Q7.) Application Layer Services
The application layer in the OSI model is the closest layer to the end user which means
that the application layer and end user can interact directly with the software application.
The application layer programs are based on client and servers.
o Network Virtual terminal: An application layer allows a user to log on to a remote
host. To do so, the application creates a software emulation of a terminal at the
remote host. The user's computer talks to the software terminal, which in turn, talks
to the host. The remote host thinks that it is communicating with one of its own
terminals, so it allows the user to log on.
o File Transfer, Access, and Management (FTAM): An application allows a user to
access files in a remote computer, to retrieve files from a computer and to manage
files in a remote computer. FTAM defines a hierarchical virtual file in terms of file
structure, file attributes and the kind of operations performed on the files and their
attributes.
o Addressing: To obtain communication between client and server, there is a need
for addressing. When a client made a request to the server, the request contains
the server address and its own address. The server response to the client request,
the request contains the destination address, i.e., client address. To achieve this
kind of addressing, DNS is used.
o Mail Services: An application layer provides Email forwarding and storage.
o Directory Services: An application contains a distributed database that provides
access for global information about various objects and services.
Authentication: It authenticates the sender or receiver's message or both.