TCP Connection Setup and Release
TCP Connection Setup and Release
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
1.1Server socket initialization
App opens a
socket for the connection
in active mode Active_Open Application wishes to communicate with a destination
TCP connection will be attempted with the server server using a TCP connection. The application opens a
socket for the connection in active mode. In this mode, a
TCP connection will be attempted with the server.
Typically, the client will use a well known port number to
communicate with the remote Server. For example,
HTTP uses port 80.
2. Client initiated three way handshake to establish a
TCP connection
SYN Client sets the SYN bit in the TCP header to request a
src = Client_Port, TCP connection. The sequence number field is set to 0.
dst = Server_Port, Since the SYN bit is set, this sequence number is used
seq_num = 0 as the initial sequence number
SYN+ACK Server sets the SYN and the ACK bits in the TCP
src = Server_Port, header. Server sends its initial sequence number as
dst = Client_Port, 100. Server also sets its window to 65535 bytes. i.e.
seq_num = 100, Server has buffer space for 65535 bytes of data. Also
ack_num = 1, note that the ack sequence numer is set to 1. This
window = 65535
signifies that the server expects a next byte sequence
number of 1
SYN Received State Now the server transitions to the SYN Received state
SYN+ACK Client receives the "SYN+ACK" TCP segment
src = Server_Port,
dst = Client_Port,
seq_num = 100,
ack_num = 1,
window = 65535
Established state At this point, the client assumes that the TCP connection
client assumes that the TCP connection has been established
has been established
ACK Server receives the TCP ACK segment
src = Client_Port,
dst = Server_Port,
ack_num = 101,
window = 5000
Established state Now the server too moves to the Established state
3. Data transfer phase: Here a short data transfer takes place, thus TCP
slow start has little impact
Split data into TCP This TCP connection limits TCP segments to 512 bytes,
segments thus the received data is split into 2 TCP segments
TCP Segment The first TCP segment is sent with a sequence number
seq_num = 1, of 1. This is the sequence number for the first byte in the
len = 512 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 512
seq_num = 513, sequence numbers. Thus, the second TCP segment
len = 512 contains data starting with 513 sequence number
TCP - Transmission Control Protocol (TCP Connection Setup and Release)
Client Node Internet Server Node
EventStudio System Designer 6
Client Net Server
Client App Client Socket Network Server Server App 19-May-13 11:14 (Page 3)
Socket
TCP Segment
seq_num = 1,
len = 512
TCP Segment
seq_num = 101,
len = 512
TCP Segment
seq_num = 613,
len = 188
TCP Segment
seq_num = 1,
len = 512
ACK
ack_num = 701
TCP - Transmission Control Protocol (TCP Connection Setup and Release)
Client Node Internet Server Node
EventStudio System Designer 6
Client Net Server
Client App Client Socket Network Server Server App 19-May-13 11:14 (Page 4)
Socket
Close_Timer Close timer has expired. Thus the client end connection
can be closed too.
Closed
delete
This sequence diagram was generated with EventStudio System Designer (http://www.EventHelix.com/EventStudio).