simple UDP client

Discussion in 'C' started by shf75, Dec 29, 2006.

  1. shf75

    shf75 New Member

    Joined:
    Dec 29, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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 ?
    Thanks,
    Sharon :)
     
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    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.
     
  3. shf75

    shf75 New Member

    Joined:
    Dec 29, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Thanks.
    Now it works.
    However, when I try to activate a thread :
    AfxBeginThread(ServerThread,0);

    I get the error :

    error C3861: 'AfxBeginThread': identifier not found

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

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    Have you configured your threading and "Use of MFC" options?
     
  5. shf75

    shf75 New Member

    Joined:
    Dec 29, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    I guess not.
    How do I go about doing this ?
    Sharon
     
  6. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice