Question
Objective: Demonstrate TCP 3-way handshake and closing a TCP connection using a client-server architecture. Requirements: 1. Create a C based client-server architecture using sockets 2.
Objective: Demonstrate TCP 3-way handshake and closing a TCP connection using a client-server architecture. Requirements:
1. Create a C based client-server architecture using sockets
2. The server should run on cse01.cse.unt.edu machine and the client should run on cse02.cse.unt.edu machine
3. The client should be able to communicate with the server using TCP segments
4. The client should be able to demonstrate a 3-way TCP handshake with the server
5. The client should be able to demonstrate closing a TCP connection.
Procedure:
1. Create a C-based server that can runs on cse01.cse.unt.edu and accepts single clients request on using sockets
2. Create a C-based client that runs on cse02.cse.unt.edu and connects to the server
3. On the client side, create a TCP segment as shown in Figure
1. Create a C structure with the following fields
a. 16-bit source and destination port [Type: short int]
b. 32-bit sequence number [Type: int]
c. 32-bit acknowledgement number [Type: int]
d. 4-bit data offset or header length (in multiples of 32-bit)
e. 6-bit reserved section
f. 6-bit flags [Type: short int for combined fields of d, e, and f]
g. 16-bit receive window for flow control [Type: short int, set to zero]
h. 16-bit checksum [Type: short int, computed after the header and data is populated]
i. 16-bit urgent data pointer [Type: short int, set to zero]
j. 32-bit Options [Type: int, set to zero]
4. The variable length payload or the data field is assumed it to be of 0 bytes, as we are going to demonstrate TCP 3-way handshaking and closing a TCP connection
5. Find the source port, destination port, and header length and populate the corresponding fields of all the client and server TCP segments created below
6. Demonstrate TCP handshaking by following the below steps. Refer to Figure 2.
a. Creating a connection request TCP segment as follows i. Assign an initial client sequence number with a zero acknowledgement number ii. Set the SYN bit to 1 iii. Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
b. The server responds to the request by creating a connection granted TCP segment as follows i. Assign an initial server sequence number with an acknowledgement number equal to initial client sequence number + 1 ii. Set the SYN bit and ACK bit to 1 iii. Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
c. The client responds back with an acknowledgement TCP segment as follows i. Assign a sequence number as initial client sequence number + 1 with an acknowledgement number equal to initial server sequence number + 1 ii. Set the ACK bit to 1 iii. Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
7. Demonstrate closing of a TCP connection by following the below steps. Refer to Figure
3. a. Create a close request TCP segment as follows i. Assign an initial client sequence number with a zero acknowledgement number ii. Set the FIN bit to 1 iii. Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
b. The server responds back with an acknowledgment TCP segment as follows
i. Assign a zero sequence number with an acknowledgement number equal to initial client sequence number + 1 ii. Set the ACK bit to 1 iii. Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
c. The server again sends another close acknowledgement TCP segment as follows i. Assign an initial server sequence number with a zero acknowledgement ii. Set the FIN bit to 1 iii. Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
d. The client responds back with an acknowledgement TCP segment as follows i. Assign a sequence number as initial client sequence number + 1 with an acknowledgement number equal to initial server sequence number + 1 ii. Set the ACK bit to 1 iii. Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
8. Assume client and server has no timeout constraints
9. Write to a file and print to the console the TCP segments transmitted and received (on both client and server side).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started