Socket program to do basic math operations (mult, div, add, sub) between 2 numbers.
INSTRUCTIONS:
- Connect to 2 different servers, or use your own computer as client side.
- Place server.py code on one server.
- Place client.py code on other server acting as client.
- On designated server run:
$ python server.py - When prompted enter a port (it will not allow a port below 1024)
- If it runs, you should see “server is ready to receive on ”
- On client, run command:
$ python client.py - It will prompt you to enter the server name where your server.py code is running.
- Then, it will prompt you to enter the port number you used on for the server.
- If you get an error CONN REFUSED, most likely, the server isn’t up or the port isn’t matched.
- If successful, you should see a prompt telling you to enter a math problem.
- To end the application, type "0/0=" as a math problem. This will also shut the server down.
The input format is a number (float) followed by an operand that can be ‘+’, ‘-‘, ‘*’, ‘/’ followed by another number (float).
Examples: (white space does not matter)
4.3 * 7
2.1 - 1
39. /3.0
56 + 11.135
NOTE: other input can be placed after the 2nd operand, but it will not be used or sent to the server.
Examples:
45-2 =
35 * 2 ignoredValues123