30dayMakeCppServer icon indicating copy to clipboard operation
30dayMakeCppServer copied to clipboard

30天自制C++服务器,包含教程和源代码

Results 60 30dayMakeCppServer issues
Sort by recently updated
recently updated
newest added

我看到的代码逻辑是: Connection对象里调用Server里的删除Connection对象的方法, 这样不就是在Connection对象的方法里删除其自身吗? 这样不会有问题吗? 还是我理解错了?

invalid

在收到client请求后,还可以添加分发器Dispatcher,可以根据对client不同的code进行业务分发。而对每个分发器后提交给具体的business处理时,还可以加上拦截器,添加一个拦截器链条。

enhancement

server的`char buf[1024]`改成`char buf[2048]`后server返回的消息会间隔一次,求教这是为什么 ```shell kyk@ubuntu:~/web_server/d2$ ./client 9 message from server: 9 8 message from server: 7 message from server: 8 6 message from server: 5 message from server: 7 4...

On Day 10 when the thread pool was first introduced, it made sense as we were pushing individual handler functions into the task queue (so thread pool achieves dynamic allocation...

我尝试打印出socket析构时候close(fd)的结果,发现它总是返回-1。 然后我在connection 读取缓冲区完毕后close(fd),这里就返回0正常关闭了套接字。 然后有时我还会遇到epoll add error: bad file descriptor的问题,这也许也和之前没有close有关吗?

raii是c++最重要的资源管理方案咋不用呢,里面全是裸指针。 从第四课封装类开始,到后面第15课都存在内存泄露的问题。最明显的就是new的InetAddress和Socket到关闭了客户端连接还没有释放。