This is the representation of a Client Server behavior using multithreading and multiprocessing in Python.
π¨ Example with multiprocess server
Python 3 and Quotes
To use the
quotes
, a pip library quotes was downloaded, it can be downloaded globally or in a virtual environment.
π Note: Client is the only service that uses this library.
pip install quotes
- Create it
python3 -m venv venv
-
Activate it
- Unix/macOS
source venv/bin/activate
- Windows
./venv\Script\activate
-
Install requirement
pip install quotes
- 𧡠Multithread server
python3 server.py multithread
or
- π¨ Multiprocess server
python3 server.py multiprocess
Start clients
python3 clients.py <number_of_clients>
Each client sends two messages to the server