# myServer **Repository Path**: weiyibo/my-server ## Basic Information - **Project Name**: myServer - **Description**: 使用C語言開發TCP服務器 - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-04-08 - **Last Updated**: 2022-05-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 说明 此项目使用多路IO复用技术,使用Reactor反应堆模式编写代码,能为后续增加Http、websocket等协议提供便利 本项目在仅有单进程下,能同时维持上万的连接数。 ## 目录说明 ``` ├── README.md ├── tcp-udpServer │ └── main.c [能同时支持udp与tcp接入] ├── tcpServer │ ├── singalThread │ │ └── main.c [支持tcp接入] │ └── threadpool │ └── main_pthread.c [引入线程池] └── test └── connect.c [大并发tcp连接测试客户端] ``` # 测试 这里以Tcp版本的服务器进行测试: 1. 不使用线程池 ![image-20220410192416613](https://www.helloimg.com/images/2022/04/10/RtPhvt.png) 2. 使用线程池 ![image-20220410192423453](https://www.helloimg.com/images/2022/04/10/RtPfsQ.png) # TODO 目前性能为1.2s左右建立1000条Tcp连接【包含三次Tcp握手和两次消息传输】 后续考虑使用多进程进行优化