Sign in to follow this  

Winsock:: How come my asynchronous sockets not sending messages to WindowProc?

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm trying to use asynchronous sockets with winsock. But for some reason winsock won't send any messenges to my WindowProc. heres my WSAAsyncSelect call, im using mfc for this program so thats why im using GetSafeHwnd().
WSAAsyncSelect(sHost, GetSafeHwnd(), WM_USER+1, 
		FD_ACCEPT|FD_WRITE | FD_CONNECT | 
                FD_READ | FD_CLOSE);



heres what my windowproc looks like:
LRESULT CHostDlg::WindowProc(UINT message, 
                     WPARAM wParam, LPARAM lParam) 
{
	if(message == (WM_USER+1))
	{
		Beep(100,30);
		
		if (WSAGETSELECTERROR(lParam))
		{
			Beep(100,30);
			WSACleanup ();
			return 0;
		}

		switch (WSAGETSELECTEVENT(lParam))
		{
			case FD_READ:
					Beep(100,30);
				break;
	
			case FD_CONNECT:
				Beep(100,30);
				break;
			
			case FD_ACCEPT:
				Beep(100,30);
				break;

			case FD_WRITE:
				Beep(100,30);
				break;

			case FD_CLOSE:
				Beep(100,30);
				break;

			default:
				Beep(100,30);
				break;
		}
	}
	return CDialog::WindowProc(message, wParam, lParam);
}



Am I doing something wrong here? thanks

Share this post


Link to post
Share on other sites

This topic is 4863 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this