Question: Python Make a simple application that connects to a server, expects to receive accio sequence from the server, sends the following confirm-accio Then expects to
Python
Make a simple application that connects to a server, expects to receive accio sequence from the server, sends the following
confirm-accio
Then expects to receive accio again, sends the following
confirm-accio-again
The client application MUST be implemented in client.py file, accepting three command-line arguments:
$ python3 client.py
Write a basic skeleton for client.py:
Add command-line parameter processing by looking at sys.argv.
Extend client.py to have routines to connect to the server/port specified as the command line parameter.
Test it with, for example, python3 client.py www.google.com 80 file.txt
Add routines to receive the command from the server. Note that the server does not to have to send this command in a single TCP data segment. In other words, .recv call may return a single byte. Your routine must be prepared to receive the command in small parts (e.g., character by character, including and .
Test it with a demo server.
Add routines to read file in chunks (e.g., 10000 bytes long) and send it over the socket.
Test again with the demo server, check if successful.
Add exception handling to gracefully handle disconnections.
Test using the second broken demo server
Add socket option and extend exception handling for 10 second timeout.
To test connection timeout, try to connect to a wrong port on a remote server. Do not try localhost, as you will immediately get an ICMP error and will not be able to test the timeout function.
To test 10 second disconnection handling, use the broken demo server.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
