Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   simple UDP client (http://www.go4expert.com/forums/simple-udp-client-t2382/)

shf75 29Dec2006 18:59

simple UDP client
I am trying to make a simple UDP ethernet client, that opens a socket, and sends
a packet to a specific server.
However, my Visual C++2005 gives me the following error :
fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
What does it want from me ? It seems also that I don't have the 'ws2_32.lib' .
What do I do ?
Does anyone have a simple client code ?
Sharon :)

DaWei 29Dec2006 19:37

Re: simple UDP client
When you downloaded the 2005 it instructed you to also download the platform SDK. Did you do that? Did you put those on your path? Your message is very clear: no such file or directory. One would presume that's what it wants from you.

shf75 30Dec2006 22:28

Re: simple UDP client
Now it works.
However, when I try to activate a thread :

I get the error :

error C3861: 'AfxBeginThread': identifier not found

even though the <windows.h> and <WinSock2.h> are included.

DaWei 31Dec2006 00:32

Re: simple UDP client
Have you configured your threading and "Use of MFC" options?

shf75 31Dec2006 01:29

Re: simple UDP client
I guess not.
How do I go about doing this ?

DaWei 31Dec2006 05:12

Re: simple UDP client
At some point, if you intend to be successful at this, you're going to have to develop some personal initiative and some resourcefulness. Missing the injunction to download the SDK is indicative; it's right in the instructions for downloading the 2005. Have you considered clicking the 'Help' button in 2005? It will allow you to search for configuration settings. One search term that happens to occur to me is "MFC." Another would be "threads." Have you considered entering "AfxBeginThread" into a Google search bar? Stuff like that. It's when you have been unable to resolve a problem after exercising due diligence (STFW, RTFM) that forums become really handy.

You can also get better responses if you include a small snippet of code that exhibits the problem. It's good to include the exact error message, as you did, and the line at which it erupted. Often, however, the error is caused by something earlier. When the compiler finally figures out the totality isn't going to be correct, it will then flag an error. Examples are missing semicolons, undefined types, etc. Information is key, both for you and for potential respondents.

All times are GMT +5.5. The time now is 19:00.