一、現象:WSAPoll老是失敗,返回INVALID_SOCKET,錯誤碼是WSAEINVAL(10022)。windows
緣由:Winsock provider不支持POLLPRI與POLLWRBAND,須要去掉:pfd.events &=~(POLLPRI|POLLWRBAND)socket
二、WSAPoll檢測不到鏈接失敗:建立一個nonblock socket,調用connect鏈接一個沒的監聽的地址,而後調用WSAPoll。不管加上POLLIN仍是POLLOUT,都檢測不到鏈接失敗,雖而後臺實際上已收到RST。這是windows的一個bug,可是已被標記爲不修復。。。ide
"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."this