Question
Write a simple HTTP client and a separate HTTP server application in C using the POSIX socket libraries. As soon as the client connects, the
Write a simple HTTP client and a separate HTTP server application in C using the POSIX socket libraries. As soon as the client connects, the client will send 20 bytes of the TCP header simulating the 3-way handshake, the server should respond to it and finally the client completes the handshake.
You must use the POSIX socket functions.
DO NOT implement the server handling multiple requests at the same time
Implement reasonable output messages that show the raw bytes of the header plus each header field in human readable format e.g.etc port numbers should be integers
You will need the following fields in the fake TCP header:
1. Source TCP port number Use a C function call to get this
2. Destination TCP port number The real port you are connecting to
3. Sequence number Create a random Initial Sequence Number
4. Acknowledgment number - You should use the appropriate value
5. TCP data offset - Make it all zeros for now
6. Reserved data Make it all zeros for now
7. Control flags flags should be set correctly for the 3-way handshake
8. Window size Use a reasonable default value e.g. 17520 bytes
9. TCP checksum Make it all ffffs for now
10. Urgent pointer Make it all zeros
Compile and run this program on LINUX as well as UHUNIX.
Submit:
Source code for client and server
Make file
Output of the 3-way handshake (both client and server)
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