Skip to content

Instantly share code, notes, and snippets.

@cuiwm
Created June 5, 2017 04:31
Show Gist options
  • Save cuiwm/d0e99bf2ad36798d8efa7808ed600fc9 to your computer and use it in GitHub Desktop.
Save cuiwm/d0e99bf2ad36798d8efa7808ed600fc9 to your computer and use it in GitHub Desktop.
//check whether the peer has close the socket connection
//netstat -antp check the rev message queue
struct pollfd pfd[1];
pfd[0].fd = socket_fd;
pfd[0].events = POLLRDHUP;
int ret = poll(pfd, 1, 0);
if (ret > 0) {
LG_DBG("poll detect RDHUP ret:%d", ret);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment