Hi.
I am getting closing to completing a simple messaging program. I will use the WSAAsyncSelect I/O mode. The design is simple, but I have found a major problem. The WSAAsyncSelect is not the best I/O mode, but it is easy to implementing for MFC based applications.
WSAAsyncSelect uses the winproc as a way to update the program about sockets including send, receive, close, accept, etc. So basically, the WSAAsyncSelect I/O mode turns an otherwise blocking socket into a non-blocking socket. It uses the WPARAM and LPARAM to store errors and data structures required to, for example, create a new socket linked to the user that is trying to connect to the server.
Now comes the problem. I declared all program data such as the socket, listening socket, sockaddr, etc. in the doc. However, WSAAsyncSelect sends a message with the WPARAM and LPARAM to main frame. I have no idea how to pass WPARAM and LPARAM from main frame to doc so I can process the data.
I see two possible solutions.
1) pass WPARAM and LPARAM from main frame to doc
2) redirect WPARAM and LPARAM from main frame to doc view SendMessage(). However, doc cannot process WM_USER message, can it? I cannot find the SendMessage() for doc.
Please post if you have a working solution for the WSAAsyncSelect I/O mode.
Thanks,
Kuphryn