在客户端,我有一个
close(sockfd)
Run Code Online (Sandbox Code Playgroud)
其中sockfd是连接到服务器的套接字.在服务器中我得到了这个:
if (sockfd.revents & POLLERR ||
desc_set[i].revents & POLLHUP || desc_set[i].revents & POLLNVAL) {
close(sockfd.fd);
printf("Goodbye (connection closed)\n");
}
Run Code Online (Sandbox Code Playgroud)
其中sockfd是struct pollfd,而sockfd.fd是客户端套接字的文件描述符.
当客户端像我放在那里那样关闭套接字时,服务器似乎没有用第二个代码(desc_set [i] .revents&POLLHUP等)检测它.
有谁知道这是什么问题?