0% found this document useful (0 votes)
106 views3 pages

TCP Connection Overview

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

Client Net Server

This sequence diagram was generated with EventStudio System Designer (http://www.EventHelix.com/EventStudio).

TCP (Transmission Control Protocol) provides a reliable end to end service that delivers packets over the Internet. Packets are
delivered in sequence without loss or duplication.

This sequence diagram explores following: (1) The three-way handshake to establish a TCP (2) Data transfer using the byte
oriented sequence numbers (3) Release of a TCP connection.

The TCP socket creation and deletion on the server and client is also covered.

1. Socket initialization
Server awaits client socket connections.

Client Net Server


2. Client initiated three way handshake to establish a TCP connection
SYN Client sets the SYN bit in the TCP header to
src = Client_Port, request a TCP connection. The sequence number
dst = Server_Port, field is set to 0. Since the SYN bit is set, this
seq_num = 0 sequence number is used as the initial sequence
number
SYN SYN TCP segment is received by the server
src = Client_Port,
dst = Server_Port,
seq_num = 0

SYN+ACK Server sets the SYN and the ACK bits in the TCP
src = Server_Port, header. Server sends its initial sequence number
dst = Client_Port, as 100. Server also sets its window to 65535 =~0.5Mbits
seq_num = 100, bytes. i.e. Server has buffer space for 65535 bytes
ack_num = 1, of data. Also note that the ack sequence numer is
window = 65535 Bytes =~0.5Mbits
=511.992 Kbits
set to 1. This signifies that the server expects a
next byte sequence number of 1
SYN+ACK Client receives the "SYN+ACK" TCP segment
src = Server_Port,
dst = Client_Port,
seq_num = 100,
ack_num = 1,
window = 65535

ACK Client now acknowledges the first segment, thus


src = Client_Port, completing the three way handshake. The receive
dst = Server_Port, window is set to 5000. Ack sequence number is
ack_num = 101, set to 101, this means that the next expected
Receive Window= window = 5000 =39.0625Kbits x13=Buffer space of data =Server window
sequence number is 101.
setting
ACK Server receives the TCP ACK segment
src = Client_Port,
dst = Server_Port,
ack_num = 101,
window = 5000

3. Data transfer phase: Here a short data transfer takes place, thus TCP slow
start has little impact

3.1 Client to server data transfer


Client Net Server
TCP Segment The first TCP segment is sent with a sequence
seq_num = 1, number of 1. This is the sequence number for the
len = 512 first byte in the segment.
(Note that unlike other protocols, TCP maintains
sequence numbers at byte level. The sequence
number field in the TCP header corresponds to the
first byte in the segment.)
TCP Segment Bytes in the first TCP segment correspond to 1 to
seq_num = 513, 512 sequence numbers. Thus, the second TCP
len = 512 segment contains data starting with 513 sequence
number
TCP Segment Data segment 1
seq_num = 1,
len = 512

TCP Segment Server receives both the segments


Data segment 2
seq_num = 513,
len = 512

ACK Server acknowledges the data segments with the


ack_num = 1025 =512+513 next expected sequence number as 1025 (TCP
typically sends an acknowledgement every two
received segments)
ACK
ack_num = 1025

3.2 Server to client data transfer


TCP Segment
seq_num = 101,
len = 512

TCP Segment
seq_num = 613,
len = 188

TCP Segment
seq_num = 1,
len = 512

TCP Segment Client has received both the TCP segments


seq_num = 613,
len = 188

ACK Client sends a TCP ACK with the next expected


ack_num = 701 sequence number set to 701

ACK
ack_num = 701

4. Client closes TCP connection


Client Net Server
4.1 Client to server TCP connection release
FIN Client sends a TCP segment with the FIN bit set in
the TCP header
FIN Server receives the FIN
ACK Server responds back with ACK to acknowledge
the FIN
ACK Client receives the ACK

4.2 Server to client TCP connection release


FIN FIN is sent out to the client to close the connection
FIN Client receives FIN
ACK Client sends ACK
ACK Server receives the ACK

This sequence diagram was generated with EventStudio System Designer (http://www.EventHelix.com/EventStudio).

You might also like