下载 TcpClient 和 TcpServer 并修改config.txt中的IP地址为 127.0.0.1 进行本地测试。如果没有Qt开发环境也可以直接下载打包好的运行程序,先启动TcpServer后再启动TcpClient。
- 本项目使用 C/S 架构,Qt界面开发,服务器数据库使用sqlite3,通信使用TCP套接字,自己封装了PDU协议来实现各种功能。
- 使用了多线程提高并发访问效率,可同时多人聊天与上传下载多个文件。
- 客户端与服务器实现多对多通信,服务器主线程进行套接字监听,子线程处理业务逻辑。
- MyTcpServer负责监听8888端口处理用户普通请求逻辑,一个客户端对应MyTcpServer下的一个子线程。
- FileTcpServer监听9999端口处理用户文件操作逻辑,一个文件操作请求对应FileTcpServer下的一个子线程。