Jump to content
  • Advertisement
Sign in to follow this  

Problem using Asynchronous Sockets

This topic is 4514 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 am currently in the process of writing a client/server using asynchronous sockets. Anyway whilst writing my server i have entered the following line of code. WSAAsyncSelect(tcpSocket, hwnd, WM_WSAASYNC, FD_READ | FD_WRITE | FD_ACCEPT | FD_CLOSE); If you want i can post the whole code but it seems a little pointless - anyway - the rest of it seems to work but i keep getting the following error returned c2065 'hwnd' undeclared identifier. Can anyone tell me why? I am running Microsoft Visual c++6 if that makes a difference. I am including winsock2.h, iostream, stdio and using namespace std. Cheers for any help you can give (PS I posted in here because the use of asynchronous sockets seemed peculiar to network programming even if it is a general programming error - sorry if its in the wrong place)

Share this post


Link to post
Share on other sites
Advertisement
You have no variable called hwnd. hwnd should be a handle to one of your windows (You need at least 1 window to use asynchrous sockets)

Share this post


Link to post
Share on other sites
ok - so how do i set one of those up - is it a complicated process or just a simple thing?

I do apologise but this is all new to me so if you could just point me in the right direction.

All the stuff i have found just says thats what i need to include, and not really how to do it!

Cheers
Neil

Share this post


Link to post
Share on other sites
The only reason to use asynchronous sockets is if you are using a Win32 window (RegisterClass, CreateWindow, the whole GetNextMessage event loop). If that's not what you are doing, you should probably use select() instead.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!