Skip to main content

一个简单的基于 socket 的聊天室

Project description

基于 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: 退出应用
    
# 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

letter2-0.0.5.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

letter2-0.0.5-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file letter2-0.0.5.tar.gz.

File metadata

  • Download URL: letter2-0.0.5.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for letter2-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c85d8fb41639cedc3908174ecc840fc82ca5605528a084238148bafd0a81527b
MD5 0a8d2dd8621c5a8aa1363cd835386d93
BLAKE2b-256 026648e3d934218ea21ad468bdc1c48ef50ca0e75fed35071960e723719635ce

See more details on using hashes here.

File details

Details for the file letter2-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: letter2-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for letter2-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f8770562864c9c08ced947fcf7128bc9f45b288a2a2c0169dd856b8715545150
MD5 2e0c30eca65686cafa18bf846a7315b1
BLAKE2b-256 bb48a649ee46102c5e9dd709057fa5e8ef51090607c5a5d9ee260355a09de14e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page