MFC对SOCKET编程的支持其实是很充分的,然而其文档是语焉不详的。以至于大多数用VC编写的功能稍
复杂的网络程序,还是使用API的。故CAsyncSocket及CSocket事实上成为疑难,群众多敬而远之。余
好事者也,不忍资源浪费,特为之注解。网友关于阻塞、非阻塞等的说法不是很可信。
====================================================
1. MSDN winsocket API 函数说明:
int WSAAsyncSelect(__in SOCKET s,
__in HWND hWnd,
__in unsigned int wMsg,
__in long lEvent
);
The WSAAsyncSelect function is used to request that WS2_32.DLL should send a message to the window hWnd when it detects any network event specified by the lEvent parameter. The message that should be sent is specified by the wMsg parameter. The socket for which notification is required is identified by the s parameter.
The WSAAsyncSelect function automatically sets socket s to nonblocking mode, regardless of the value of lEvent. To set socket s back