This is demo project for chat room by python.
For convenience, you can find the executable chatroom.exe under chatroom_demo\dist\windows
- accept all clients
chatroom.exe serve --bind-ip 127.0.0.1 --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem
- accept authorized clients only
chatroom.exe serve --bind-ip 127.0.0.1 --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem --allowed-clients D:\your_path\chatroom_demo\conf\client_cert\client1.crt
- connect server without allowed client certificate
chatroom.exe connect --host localhost --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem --handle username
- connect server with allowed client certificate
chatroom.exe connect --host localhost --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem --client-cert D:\your_path\chatroom_demo\conf\client_cert\client1.pem --handle username
-
Install python
Download & install Python 3.8.0 from https://www.python.org.
-
Install requirements
pip install -r res/requirements.txt
-
Execute Server
- accept all clients
python main.py serve --bind-ip 127.0.0.1 --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem
- accept authorized clients only
python main.py serve --bind-ip 127.0.0.1 --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem --allowed-clients D:\your_path\chatroom_demo\conf\client_cert\client1.crt
-
Execute Client
- connect server without allowed client certificate
python main.py connect --host localhost --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem --handle username
- connect server with allowed client certificate
python main.py connect --host localhost --bind-port 8567 --ca-file D:\your_path\chatroom_demo\conf\server_cert\server.pem --client-cert D:\your_path\chatroom_demo\conf\client_cert\client1.pem --handle username
pyinstaller -F main.py
note: if it shows "TypeError: an integer is required (got type bytes)", you can fix it by installing developer version.
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
ref: pyinstaller/pyinstaller#4265
python built-in curses not support on windows, there is an extension required.
Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
Download & install curses‑2.2.1+utf8‑cp38‑cp38