C++ Programming
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
Related Questions
. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java
CS 340 Milestone One Guidelines and Rubric
Overview: For this assignment, you will implement the fundamental operations of create, read, update,
. 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
Retail Transaction Programming Project
Project Requirements:
Develop a program to emulate a purchase transaction at a retail store. This
. The following program contains five errors. Identify the errors and fix them
7COM1028
Secure Systems Programming
Referral Coursework: Secure
. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer
CS 340 Final Project Guidelines and Rubric
Overview The final project will encompass developing a web service using a software stack and impleme