test for _MSC_VER before using MSVC specific code
WinSock2.h filename should be all lowercase
Merge pull request #697 from pijyoi/master

bugfixes for mingw compilation