I am confused about couple of things about winsock.
First, what the difference between including Winsock2.h vs winsock2.h (caps of 'w')
Second, what is the difference between linking with wsock32.lib with ws2_32.lib?
I have tried couple of combinations and they result in compile time errors. Can anyone explain me the logical reasoning behind what to use?
Thanks Nick
The library ws2_32. lib is an import library. It consist of small stubs that will redirect to the actual implementation in ws2_32. dll.
The Winsock2. h header file internally includes core elements from the Windows. h header file, so there is not usually an #include line for the Windows. h header file in Winsock applications. If an #include line is needed for the Windows.
The fd_set structure (winsock. h) is used by Windows Sockets (Winsock) functions and service providers to place sockets into a set. HOSTENT. The HOSTENT (winsock. h) structure is used by functions to store information about a given host, such as host name, IPv4 address, and so forth.
The current Winsock DLL, Ws2_32. dll, supports applications that request any of the following versions of Windows Sockets specification: 1.0.
There is no difference between Winsock2.h
and winsock2.h
. Filenames are case-insensitive on typical Windows filesystems. The ws2_32.lib
file is for Winsock 2, while wsock32.lib
is for the obsolete, older version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With