基于 Socket 的终端聊天室
1.构建服务器
import letter2 as letter
service = letter.service(
# 数据库配置【以下都是默认值】
mysql_host='localhost',
mysql_port=3306,
mysql_user='root',
mysql_database='letter',
mysql_password='1234',
# 服务器端配置【以下都是默认值】
service_host='localhost',
service_port=5000,
max_client=5,
encoding='utf8'
)
service.start()
2.运行客服端
import letter2 as letter
client = letter.client(
# 以下均为默认值
service_host='localhost',
service_port=5000,
encoding='utf-8'
)
client.start()
3.客服端使用帮助
_ _ _ _ _ _ ___ ___
| | | | | | | (_) | | |__ \ / _ \
| | ___| |_| |_ ___ _ __ ___| |_ ___ _ __ | |_ ) || | | |
| |/ _ \ __| __/ _ \ '__| / __| | |/ _ \ '_ \| __| / / | | | |
| | __/ |_| || __/ | | (__| | | __/ | | | |_ / /_ | |_| |
|_|\___|\__|\__\___|_| \___|_|_|\___|_| |_|\__| |____(_)___/
$ 2023-12-16 12:57:35 > letter2 2.0 client starting...
$ 2023-12-16 12:57:35 > letter2 2.0 client stared!
$ 2023-12-16 12:57:35 > 目前正处于离线模式, 你可以输入 login 登录聊天室
# help
绿色表示在线才能使用的功能
红色表示离线才能使用的功能
白色不做限制
ls: 显示所有在线用户
me: 显示自己的状态
clear: 清空记录
help: 查看帮助
path: 显示当前目录,及目录下的所有子目录
login: 登录服务器
register: 注册一个账户并登录服务器
chat [all|username] [text]: 给[所有|指定]用户发送消息
file [filepath] to [username]: 给指定用户发送文件
logout: 退出登录
repwd [old password] [new password]: 修改密码
exit: 退出应用
#
Metadata
Release files for letter2 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| letter2-0.0.5.tar.gz | 8.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| letter2-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / letter2-0.0.5.tar.gz
| Download URL | letter2-0.0.5.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c85d8fb41639cedc3908174ecc840fc82ca5605528a084238148bafd0a81527b
|
|
BLAKE2b-256 checksum How to use checksums |
026648e3d934218ea21ad468bdc1c48ef50ca0e75fed35071960e723719635ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.18
|
Release files / letter2-0.0.5-py3-none-any.whl
| Download URL | letter2-0.0.5-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8770562864c9c08ced947fcf7128bc9f45b288a2a2c0169dd856b8715545150
|
|
BLAKE2b-256 checksum How to use checksums |
bb48a649ee46102c5e9dd709057fa5e8ef51090607c5a5d9ee260355a09de14e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.18
|
Security for letter2 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.