Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

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

This topic is 5168 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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!