|
发表于 2009-6-29 14:34:48
|
显示全部楼层
原帖由 wishel 于 2009-6-29 14:01 发表
我理解的应该不是这样。send失败之后,下一次reactor检查,只有可以send(缓冲区容量够),才会触发。所以handle_output再次触发就不会失败。
这个有点像epoll的et模式,只有状态变化,从不可写到变为可写才会触发。如果一直是可 ...
查了一下msdn你说的是正确的,handle_output再次触发的时候,一定处于可以发送的状态了。
The FD_WRITE network event is handled slightly differently. An FD_WRITE network event is recorded when a socket is first connected with connect/WSAConnect or accepted with accept/WSAAccept, and then after a send fails with WSAEWOULDBLOCK and buffer space becomes available. Therefore, an application can assume that sends are possible starting from the first FD_WRITE network event setting and lasting until a send returns WSAEWOULDBLOCK. After such a failure, the application will find out that sends are again possible when an FD_WRITE network event is recorded and the associated event object is set. |
|