Coder Social home page Coder Social logo

chat_room's Introduction

网络聊天室

目录结构

├── chat_room.h 	// 存放sqlite函数声明和消息传递结构体
├── client.cpp		// 客户端的实现
├── Makefile
├── README.md
├── server.cpp		// 服务器的实现
└── sqlite.cpp		// 数据库部分的实现

sqlite数据库

介绍

SQLite 是一种嵌入式关系型数据库管理系统(RDBMS),它在一个单一的、自包含的文件中实现了一个完整的、独立的 SQL 数据库引擎。与传统的客户端-服务器数据库管理系统不同,SQLite 不需要一个单独的服务器进程来管理数据库,而是直接将数据库存储在磁盘上的文件中。

ubuntu上安装sqlite

sudo apt install sqlite3 libsqlite3-dev

sqlite命令分类

  • 系统命令:是以.开头的命令,主要用于对当前数据库操作
  • 普通命令:是以;结尾的命令,主要对数据库中的表进行操作

sqlite常用命令

.open <name>    打开指定数据库
.schema         查看表的结构
.table          列出当前数据库中所有表
.quit           退出数据库
.exit           退出数据库
.help           查看帮助信息
.databases      查看数据库

运行本项目

make
./server <ip> <port>
./client <ip> <port>

功能

  • 注册
  • 群聊
  • 私聊
  • 添加好友验证
  • 切换聊天
  • 用户退出聊天室发送下线消息

存在的bug

  • 可以同时登陆同一个帐号
  • 添加好友是单向的
  • 客户端直接使用Ctrl+C终止client程序会导致用户未改变数据库中state标志,账号无法再次登陆
  • 私聊开始时会发送一个空白消息
  • 回复发来的私聊消息仍需输入好友ID
  • 可以输入错误操作码
  • 添加好友验证只有在选择群聊或者私聊后才显示

chat_room's People

Contributors

lidonghang-02 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.