Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Windows sockets ?

  1. May 27, 2005 #1
    Im trying to play with sockets on windows

    what lib do i need to link to make this statement work? Does it come with win or do i have to download it?

    WSAStartup(MAKEWORD(1,1), &wsa);
  2. jcsd
  3. May 29, 2005 #2
  4. May 29, 2005 #3
    Thanx enathan, i have that library in my windows/system32 dir but when i try to compile program using the above code it says link error.

    Why is that. I can use socket dlls and stuff but not this ? something im doing wrong...?
  5. May 30, 2005 #4
    I am assuming you are using C# or C++

    You have to tell the compiler to include the library somehow. I think the keyword (or drective) is #Include <library>; I forget lol I have not programmed C# for a long time.

    What exactly is the compiler error BTW?
  6. May 31, 2005 #5


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    The .dll is not a library -- it's a shared object. You need to link against the .lib file corresponding to the .dll, which provides all the signatures for linking. You also do not use the #include directive for anything involving libraries; the #include directive affects the source, and only the compiler deals with the source itself. The linker deals with the resulting object files, and has nothing to do with the source.

    You need to link against the library Ws2_32.lib, present (on my Windows XP SP2 machine) in C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib

    In the future, please use MSDN to search for documentation: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/wsastartup_2.asp

    - Warren
  7. May 31, 2005 #6
    thanx a lot

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Windows sockets ?