Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 569
Nick Avatar asked Jul 22 '13 21:07

Nick


People also ask

What is ws2_32 lib?

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.

What is include Winsock2 H?

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.

What is Winsock H?

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.

Which of the following DLL is required to run Winsock Version 2 application?

The current Winsock DLL, Ws2_32. dll, supports applications that request any of the following versions of Windows Sockets specification: 1.0.


1 Answers

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.

like image 63
David Schwartz Avatar answered Oct 12 '22 15:10

David Schwartz