If you look inside winsock2.h, you can see that it includes windows.h.
And if you look inside windows.h, you can see that it includes winsock.h.
But winsock2.h makes sure that none of the contents of winsock.h are valid by defining
_WINSOCKAPI_
.
Here is the line from winsock2.h -
#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */
And if you look inside winsock.h, all its contents are with these statments -
#ifndef _WINSOCKAPI_
#endif
So in short, you must not use both together.