我现在就想问:
对于SO_KEEPALIVE,MSDN说:
If a connection is dropped as the result of keep-alives the error code WSAENETRESET is returned to any calls in progress on the socket, and any subsequent calls will fail with WSAENOTCONN.
我使用SO_KEEPALIVE,但结果不象MSDN写的,各位不知有没有用过,介绍一下。
1.用Event I/O可解决。但还是没搞清楚CSocket在线程中怎么会这样。
2.用了Ping解决。但心有不甘,tcp这样面向连接的协议,还要在用户程序这一级做这些事吗?搞得跟写Udp一样。在sock option有SO_KEEPALIVE一项,MSDN说:
If a connection is dropped as the result of keep-alives the error code WSAENETRESET is returned to any calls in progress on the socket, and any subsequent calls will fail with WSAENOTCONN.但我试了一下,好像不是那么回事。不知各位试过没有