This project implements client-server communication using socket programming in Python. It includes one client program and four server programs, each handling a different number of concurrent clients.
client.py
: The client programserver1.py
: Handles one client at a timeserver2.py
: Handles two clients concurrentlyserver3.py
: Handles three clients concurrentlyserver4.py
: Echo server handling multiple clients
- Arithmetic operations (+, -, *, /) with multiple operands
- Flexible input parsing (handles various spacing between operands and operators)
- Error handling for invalid operations
- Socket timeout for client-side server availability detection
python server#.py # Replace # with 1, 2, 3, or 4
python client.py
Comprehensive tests have been conducted to ensure:
- Correct arithmetic operations
- Proper handling of multiple clients
- Graceful disconnection and reconnection
- Error handling and edge cases
- Multi-operand arithmetic operations
- Flexible input parsing
- Robust error handling
- The server uses file numbers to refer to clients, which may be the same for different clients.
- For
server1.py
, a timeout feature is implemented to handle busy server scenarios.
Contributions are welcome. Please fork the repository and submit a pull request with your changes.