2 michaeljon123 MichaelJon123 于 2015.07.03 17:14 提问

处理EPOLLIN事件 recv MSG_PEEK 返回 EAGAIN

处理EPOLLIN事件
n = recv(fd, buf, 1, MSG _ PEEK);
返回-1, errno是EAGAIN, 请问是怎么回事。
通过tcpdump看到的确是有数据来了

3个回答

devmiao
devmiao   Ds   Rxr 2015.07.03 21:42
MichaelJon123
MichaelJon123   2015.07.07 19:31

http://stackoverflow.com/questions/3664537/nonblocking-socket-recv-problem-while-using-it-with-epoll上说
epoll_wait() only told you that there was a new socket to accept() - it did not tell you that there was data to read from the new socket.
真的是这样的吗?
为啥有数据epoll告诉有数据,(这里已排除对端close的情况,),调recv却还是EAGAIN. 这种情况在大量请求时仅出现过很少次。

oyljerry
oyljerry   Ds   Rxr 2015.07.03 19:44
Csdn user default icon
上传中...
上传图片
插入图片