Beruflich Dokumente
Kultur Dokumente
Explain TCP connection management (or) TCP architecture (or) working of TCP protocol.
➢ Client performs an active connection to establish connection with a passive open
server, prior to data communication
➢ Finally connection is terminated after data transmission.
Connection Establishment
➢ Connection establishment in TCP is a three-way handshaking.
1. Client sends a SYN segment to the server containing its initial sequence number
(Flags = SYN, SequenceNum = x)
2. Server responds with a segment that acknowledges client’s segment and specifies its
initial sequence number (Flags = SYN+ ACK, Ack = x + 1 SequenceNum = y).
3. Finally, client responds with a segment that acknowledges server’s sequence number
(Flags = ACK, Ack = y + 1).
Connection Termination
➢ Connection termination is normally done using a three-way close.
o Client sends a FIN segment to the server for connection termination.
o Server responds with FIN + ACK segment to inform its closing.
o Finally, client sends an ACK segment.
➢ Resources provided for the connection are released.
State Transition Diagram
➢ States involved in opening and closing a connection is shown above and below the
ESTABLISHED state.
➢ Sate transition occurs either due to arrival of a segment or when an TCP operation is
invoked by the application.
➢ Operation of sliding window is hidden in the ESTABLISHED state.
Opening
1. Server invokes a passive open on TCP, which causes TCP to move to LISTEN state.
2. Client does an active open, which causes its TCP to send a SYN segment to the
server and move to SYN_SENT state.
3. When SYN segment arrives at the server, it moves to SYN_RCVD state and responds
with a SYN + ACK segment.
4. Arrival of SYN + ACK segment causes the client to move to ESTABLISHED state and
sends an ACK to the server.
5. When ACK arrives, the server finally moves to ESTABLISHED state.
Closing
➢ Client / Server can close the connection independently or simultaneously.
Transitions from ESTABLISHED to CLOSED state are:
➢ One side closes: ESTABLISHED→FIN_WAIT_1→FIN_WAIT_2→TIME_WAIT→CLOSED
➢ Other side closes: ESTABLISHED → CLOSE_WAIT → LAST_ACK → CLOSED
➢ Simultaneous close: ESTABLISHED→FIN_WAIT_1→CLOSING→TIME_WAIT→ CLOSED
What is half-way close in TCP connection?
➢ Half-Close—Client stops sending but receives data. This is known as half-
close. o Client half-closes the connection by sending a FIN segment.
o Server sends an ACK segment. Data transfer from client to the server stops.
o After sending all data, server sends FIN segment to client, which is
acknowledged by the client.
How is urgent data delivered in TCP?
➢ A process may send urgent data. For example, abort a process by Ctrl + C keystroke.
➢ Sending TCP inserts the urgent data at beginning of the segment and sets URG flag.
➢ When TCP receives a segment with URG bit set, it delivers urgent data out of order
to the receiving application.
What is push operation in TCP?
➢ Receiving TCP buffers the data and delivers when process is ready.
➢ When a process issues Push operation, the sending TCP sets the PUSH flag, which
forces the TCP to create a segment and send it immediately.
➢ When TCP receives a segment with PUSH flag set, it is delivered immediately.
Distinguish between connection-less and connection-oriented protocol in transport layer.
UDP (Connection-less) TCP (Connection-oriented)
Datagram model (connection-less) Byte-stream service (connection-oriented)
Unreliable delivery Reliable delivery using acknowledgement
No flow control Supports flow control
No congestion control Built-in congestion control mechanism
Light overhead Heavy overhead
Data is collected in order of receipt Segments are ordered using sequence number
Explain TCP flow control (or) adaptive flow control (or) TCP Sliding window in detail.
➢ TCP uses a variant of sliding window known as adaptive flow control that:
o guarantees reliable and ordered delivery of data to receiver
o enforces flow control at the sender
➢ Receiver advertises its window size to the sender using AdvertisedWindow field.
➢ Sender thus cannot have unacknowledged data greater than AdvertisedWindow.
Compare the usage of sliding window algorithm in datalink layer and TCP.
➢ Single link always connects the same two hosts, whereas TCP allows processes
running on any two hosts to be connected.
➢ TCP connections have varying RTTs, whereas over a single link, RTT is fixed.
➢ Packets may be reordered over internet, whereas on a link it is impossible.
➢ Single link supports delay × bandwidth product, whereas in TCP it’s flow control.
➢ Congestion is not possible on a link, whereas TCP connection is not aware of what
links it will traverse and their capacities.
CS6551-Computer Networks 4.14
Example
➢ In the example, Pseudo header, UDP header and Data are written as 16-bit words.
➢ All words are summed up.
➢ Complement of sum is known as UDP checksum.