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

Client Socket Interactions

This sequence diagram shows: 1) A three-way handshake between a client and server to establish a TCP connection, including the client sending a SYN packet, receiving a SYN-ACK from the server, and responding with an ACK. 2) Data transfer using TCP segments with sequence numbers from client to server and server to client. 3) Release of the TCP connection with the client sending a FIN packet and receiving an ACK from the server, then both entering FIN_WAIT states before closing the connection.

Uploaded by

ZteTems Opt
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)
56 views3 pages

Client Socket Interactions

This sequence diagram shows: 1) A three-way handshake between a client and server to establish a TCP connection, including the client sending a SYN packet, receiving a SYN-ACK from the server, and responding with an ACK. 2) Data transfer using TCP segments with sequence numbers from client to server and server to client. 3) Release of the TCP connection with the client sending a FIN packet and receiving an ACK from the server, then both entering FIN_WAIT states before closing the connection.

Uploaded by

ZteTems Opt
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/ 3

Client App Network

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.

Socket initialization
Server awaits client socket connections.

Client socket initialization

create Client Socket Client Application creates Socket

Closed The socket is created in the Closed state


seq_num = 0 Initial sequence number is set to 0

Active_Open Application wishes to communicate with a


destination 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.
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 Sent Socket transitions to the SYN Sent state
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
window = 5000 sequence number is 101.

Established At this point, the client assumes that the TCP


connection has been established

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

Client to server data transfer


Client App Client Socket Network
Data Client application sends 1024 bytes of data to the
size = 1024 socket

Split data into TCP segments This TCP connection limits TCP segments to 512
bytes, thus the received data is split into 2 TCP
segments
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
ACK
ack_num = 1025

Server to client data transfer


TCP Segment
seq_num = 1,
len = 512

TCP Segment Client has received both the TCP segments


seq_num = 613,
len = 188

Assemble TCP Segments

Data Socket passes data to Client application


size = 700

ACK Client sends a TCP ACK with the next expected


ack_num = 701 sequence number set to 701

Client closes TCP connection

Client to server TCP connection release


Close Client application wishes to release the TCP
connection
FIN Client sends a TCP segment with the FIN bit set in
the TCP header
FIN Wait 1 Client changes state to FIN Wait 1 state
ACK Client receives the ACK
FIN Wait 2 Client changes state to FIN Wait 2. In this state,
the TCP connection from the client to server is
closed. Client now waits close of TCP connection
from the server end

Server to client TCP connection release


Client App Client Socket Network
FIN Client receives FIN
ACK Client sends ACK
Close_Timer Client starts a timer to handle scenarios where the
last ack has been lost and server resends FIN
Time Wait Client waits in Time Wait state to handle a FIN
retry
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).

You might also like