Answered step by step
Verified Expert Solution
Question
1 Approved Answer
just any html file works , concept is more important Networks > over TCP 1 of 2 are to implement client-server communication over TCP transport-layer
just any html file works , concept is more important
Networks > over TCP 1 of 2 are to implement client-server communication over TCP transport-layer protocol using HTTP application layer protocol. You are to submit code for two programs: one for client side (e.g. TCPClient.py) and one for server side (e.g. TCPServer.py). Compressed folder containing two source files has to be submitted on Moodle. Requirements for server side code: 1. Accepts and parses the HTTP GET request. 2. Gets the requested object from the server's file system*. 3. Creates an HTTP response message consisting of the requested object preceded by an appropriate response status line. 4. Sends the HTTP response directly to the client. 5. Send an HTTP "404 Not Found" response back to the client if the requested object is not present. Requirements for client side code: 1. Connects to the server using a TCP connection. 2. Sends an HTTP GET request to the server. 3. Displays the server response as an output. 4. Takes command line arguments specifying the server IP address, the port at which the server is listening, and the name of the requested object. Sample command to run the client code: python TCPClient.py server_ip server_port filename Sample outputs of client code: ateat:-$ python TCPClient.py 192.168.1.12 12000 index.html HTTP request to server: GET /index.html HTTP/1.1 Host: 192.168.1.12 HTTP response from server: HTTP/1.1 200 OK Assignment #2
at@at:-$ python TCPClient.py 192.168.1.12 12000 home.html HTTP request to server: GET /home.html HTTP/1.1 Host: 192.168.1.12 HTTP response from server: HTTP/1.1 404 Not Found Sample output of server code: at@at:-$ python TCPServer.py The server is ready to receive... HTTP request: GET /index.html HTTP/1.1 Host: 192.168.1.14 Object to be fetched: index.html Object content:Assignment #2
HTTP response message: HTTP/1.1 200 OKAssignment #2
HTTP request: GET /home.html HTTP/1.1 Host: 192.168.1.12 Object to be fetched: home.html HTTP response message: HTTP/1.1 404 Not Found *Put an HTML file (e.g. index.html) in the same directory with the server code. When the server code is running, you should be able to access the index.html file (in browser) through server_ip:server_port/filename (e.g. 192.169.25.33:11000/index.html). "Gets the requested object from the server's file system" means opening and reading index.html file in server code (e.g.f = open(filename) ... f.read(), where filename is "index.html"). Networks > over TCP 1 of 2 are to implement client-server communication over TCP transport-layer protocol using HTTP application layer protocol. You are to submit code for two programs: one for client side (e.g. TCPClient.py) and one for server side (e.g. TCPServer.py). Compressed folder containing two source files has to be submitted on Moodle. Requirements for server side code: 1. Accepts and parses the HTTP GET request. 2. Gets the requested object from the server's file system*. 3. Creates an HTTP response message consisting of the requested object preceded by an appropriate response status line. 4. Sends the HTTP response directly to the client. 5. Send an HTTP "404 Not Found" response back to the client if the requested object is not present. Requirements for client side code: 1. Connects to the server using a TCP connection. 2. Sends an HTTP GET request to the server. 3. Displays the server response as an output. 4. Takes command line arguments specifying the server IP address, the port at which the server is listening, and the name of the requested object. Sample command to run the client code: python TCPClient.py server_ip server_port filename Sample outputs of client code: ateat:-$ python TCPClient.py 192.168.1.12 12000 index.html HTTP request to server: GET /index.html HTTP/1.1 Host: 192.168.1.12 HTTP response from server: HTTP/1.1 200 OKAssignment #2
at@at:-$ python TCPClient.py 192.168.1.12 12000 home.html HTTP request to server: GET /home.html HTTP/1.1 Host: 192.168.1.12 HTTP response from server: HTTP/1.1 404 Not Found Sample output of server code: at@at:-$ python TCPServer.py The server is ready to receive... HTTP request: GET /index.html HTTP/1.1 Host: 192.168.1.14 Object to be fetched: index.html Object content:Assignment #2
HTTP response message: HTTP/1.1 200 OKAssignment #2
HTTP request: GET /home.html HTTP/1.1 Host: 192.168.1.12 Object to be fetched: home.html HTTP response message: HTTP/1.1 404 Not Found *Put an HTML file (e.g. index.html) in the same directory with the server code. When the server code is running, you should be able to access the index.html file (in browser) through server_ip:server_port/filename (e.g. 192.169.25.33:11000/index.html). "Gets the requested object from the server's file system" means opening and reading index.html file in server code (e.g.f = open(filename) ... f.read(), where filename is "index.html")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