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.4.tar.gz (8.2 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.4-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: letter2-0.0.4.tar.gz
  • Upload date:
  • Size: 8.2 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.4.tar.gz
Algorithm Hash digest
SHA256 7141f8eacd7ecf6dca7138d0c54d04e7438a6c7a0c489fe34caaffca6da3e46d
MD5 7e2c113d7f1adab6973cb0fd58b87848
BLAKE2b-256 1c655978b2ec81b272be9157f76a4f61f8483f89bdc5cc6799c0a01ccaae59ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: letter2-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c71315f0e1905c9a9809c7b472ab5a2e78dd644c018c3a9ff09edd1cbab3e8cc
MD5 4646642212928da0ba2afae8c8da6718
BLAKE2b-256 87ac131d9f5a0e3a9cee257a23b7dddc4b0243a1c70b20d1a372f1a4a9b0b096

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