Unresolved External Symbol C++
Thats because in Visual Studio, including winsock2.h to your headers is not enough. You have to tell the Linker your project will need the library wsock32.lib.

You can do that either by editing the properties of your project, or by including this line to your code:

#pragma comment(lib, "wsock32.lib")