TinyWebServer icon indicating copy to clipboard operation
TinyWebServer copied to clipboard

客户端发完请求,半关闭连接,但是仍然想要接收回应,是不是没有正确处理这种情况

Open liyuanze opened this issue 2 years ago • 3 comments

liyuanze avatar Aug 20 '22 08:08 liyuanze

else if (events[i].events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR)) { //服务器端关闭连接,移除对应的定时器 util_timer *timer = users_timer[sockfd].timer; deal_timer(timer, sockfd); } 如果触发的事件是EPOLLRDHUP,代表对端关闭写,但是仍然可读,我们可以继续返回正确的响应,但是这里直接关闭了连接。

liyuanze avatar Aug 20 '22 09:08 liyuanze

同问,请问知道如何解决了吗?

else if (events[i].events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR)) { //服务器端关闭连接,移除对应的定时器 util_timer *timer = users_timer[sockfd].timer; deal_timer(timer, sockfd); } 如果触发的事件是EPOLLRDHUP,代表对端关闭写,但是仍然可读,我们可以继续返回正确的响应,但是这里直接关闭了连接。

同问,请问知道如何解决了吗

cellphonef avatar Apr 06 '23 06:04 cellphonef

对端关闭写不就是客户端不发送请求了吗,那不关闭连接应该怎么做

diandengpao avatar Apr 22 '23 15:04 diandengpao