读书人

SOCKET 中 WSAAsyncSelect 的使用有关

发布时间: 2012-01-23 21:57:28 作者: rapoo

SOCKET 中 WSAAsyncSelect 的使用问题
SOCKET 中 WSAAsyncSelect 的使用问题,请各位大虾给个例子
我正在编写服务器客户端程序,想通过WSAAsyncSelect来实现数据的发送与接收,怎么用啊,晕~~~~~~~~~

[解决办法]
以 WSAAsyncSelect 作为关键字搜索,应该能找到不少文章。
[解决办法]
WSAAsyncSelect
The WSAAsyncSelect function requests Windows message-based notification of network events for a socket.

int WSAAsyncSelect( SOCKET s, HWND hWnd, unsigned int wMsg, long lEvent);

Parameters
s
[in] A descriptor that identifies the socket for which event notification is required.
hWnd
[in] A handle that identifies the window that will receive a message when a network event occurs.
wMsg
[in] A message to be received when a network event occurs.
lEvent
[in] A bitmask that specifies a combination of network events in which the application is interested.

大体的意思是:WSAAsyncSelect函数是基于窗口通知消息的,这个消息是来自于一个Socket上的网络事件通知。
参数:s是一个向绑定窗口发送事件通知消息的socket.
hWnd是接收网络事件消息的窗口的句柄。
wMsg是网络事件发生时被送出,且被hWnd标识的窗口接收的消息。
lEvent是一个二进制的位掩码,它标识应用程序希望接收的网络事件消息的组合。

详细情况请查阅MSDN,顺便说一下我不是学英语的,翻译的不对请多海涵!

读书人网 >VC/MFC

热点推荐