MaferMazu / multithread-sockets-python

Multithread Sockets in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🌟 Multithread Sockets Python

This is the representation of a Client Server behavior using multithreading and multiprocessing in Python.

multiprocess.gif πŸ”¨ Example with multiprocess server

πŸ“Œ Requirements

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.

Install quotes globally

pip install quotes

If you want to create virtual enviroment

  • Create it
python3 -m venv venv
  • Activate it

    • Unix/macOS
    source venv/bin/activate
    • Windows
    ./venv\Script\activate
  • Install requirement

pip install quotes

πŸ”₯ How to use

πŸ“‘ Server

  • 🧡 Multithread server
python3 server.py multithread

or

  • πŸ”¨ Multiprocess server
python3 server.py multiprocess

πŸ‘§ Clients

Start clients

python3 clients.py <number_of_clients>

Each client sends two messages to the server

About

Multithread Sockets in python


Languages

Language:Python 100.0%