Nick Nick - 1 month ago 23
C++ Question

Winsock2.h vs winsock2.h and wsock32.lib vs ws2_32.lib

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

Answer

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.

Comments