Demonstrate TCP 3-way handshake and closing a TCP connection using a client-server architecture.
INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS
Objective:
Demonstrate TCP 3-way handshake and closing a TCP connection using a client-server architecture.
Requirements:
- Create a C based client-server architecture using sockets
- The server should run on cse01.cse.unt.edu machine and the client should run on cse02.cse.unt.edu machine
- The client should be able to communicate with the server using TCP segments
- The client should be able to demonstrate a 3-way TCP handshake with the server
- The client should be able to demonstrate closing a TCP connection.
Procedure:
- Create a C-based server that can runs on cse01.cse.unt.edu and accepts single client’s request on using sockets
- Create a C-based client that runs on cse02.cse.unt.edu and connects to the server
- On the client side, create a TCP segment as shown in Figure Create a C structure with the following fields
- 16-bit source and destination port [Type: unsigned short int]
- 32-bit sequence number [Type: unsigned int]
- 32-bit acknowledgement number [Type: unsigned int]
- 4-bit data offset or header length (in multiples of 32-bit)
- 6-bit reserved section
- 6-bit flags [Type: unsigned short int for combined fields of d, e, and f]
- 16-bit receive window for flow control [Type: unsigned short int, set to zero]
- 16-bit checksum [Type: unsigned short int, computed after the header and data is populated]
- 16-bit urgent data pointer [Type: unsigned short int, set to zero]
- 32-bit Options [Type: unsigned int, set to zero]
- The variable length payload or the data field is assumed it to be of 0 bytes, as we are going to demonstrate opening and closing a TCP connection
- Find the source port, destination port, and header length and populate the corresponding fields of all the client and server TCP segments created below
- Demonstrate opening of a TCP connection by following the below steps. Refer to Figure
- Create a connection request TCP segment as follows
- Assign an initial client sequence number with a zero acknowledgement number
- Set the SYN bit to 1
- Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
- The server responds to the request by creating a connection granted TCP segment. Create a connection granted response as follows
- Assign an initial server sequence number with an acknowledgement number equal to initial client sequence number + 1
- Set the SYN bit and ACK bit to 1
- Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
- The client responds back with an acknowledgement TCP segment. Create an acknowledgement TCP segment as follows
- Assign a sequence number as initial client sequence number + 1 with an acknowledgement number equal to initial server sequence number + 1
- Set the ACK bit to 1
- Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
- Demonstrate closing of a TCP connection by following the below steps. Refer to Figure
- Create a close request TCP segment as follows
- Assign an initial client sequence number with a zero acknowledgement number
- Set the FIN bit to 1
- Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
- The server responds back with an acknowledgment TCP segment. Create an acknowledgement TCP segment as follows
- Assign a initial server sequence number with an acknowledgement number equal to initial client sequence number + 1
- Set the ACK bit to 1
- Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
- The server again sends another close acknowledgement TCP segment. Create the TCP segment as follows
- Assign an initial server sequence number with an acknowledgement number equal to initial client sequence number + 1
- Set the FIN bit to 1
- Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
- The client responds back with an acknowledgement TCP segment. Create an acknowledgement TCP segment as follows
- Assign a sequence number as initial client sequence number + 1 with an acknowledgement number equal to initial server sequence number + 1
- Set the ACK bit to 1
- Compute the 16-bit checksum of the entire TCP segment and populate the checksum field
- Assume client and server has no timeout constraints
- Write to a file (server.out and client.out) and print to the console the TCP segments transmitted and received (on both server side and client side).
- An example code (cksum.c) to compute the checksum is given on
Attachments:
Related Questions
. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 1
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of
. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 2
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of