Windows sockets ?

  • Thread starter sneez
  • Start date
  • #1
312
0
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);
 

Answers and Replies

  • #3
312
0
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...?
 
  • #4
352
1
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?
 
  • #5
chroot
Staff Emeritus
Science Advisor
Gold Member
10,226
34
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 [Broken]

- Warren
 
Last edited by a moderator:
  • #6
312
0
thanx a lot

:d
 

Related Threads on Windows sockets ?

  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
8
Views
12K
Replies
1
Views
3K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
4
Views
4K
  • Last Post
Replies
3
Views
2K
Replies
16
Views
5K
  • Last Post
Replies
18
Views
5K
Replies
14
Views
3K
Replies
0
Views
2K
Top