1、现象:WSAPoll总是失败,返回INVALID_SOCKET,错误码是WSAEINVAL(10022)。
原因:Winsock provider不支持POLLPRI与POLLWRBAND,需要去掉:pfd.events &=~(POLLPRI|POLLWRBAND)
2、WSAPoll检测不到连接失败:创建一个nonblock socket,调用connect连接一个没的监听的地址,然后调用WSAPoll。无论加上POLLIN还是POLLOUT,都检测不到连接失败,虽然后台实际上已收到RST。这是windows的一个bug,但是已被标记为不修复。。。
"Windows 8 Bugs 309411 - WSAPoll does not report failed connections
8/3/2011 6:53 PM Resolved as Won't Fix by muraris
Has been like this forever and people are already used to it."
"The recommendation for now is to not use the WSAPoll function it in case you encounter this issue, but rather the other Net-API functions."