a) defined Windows version: added -D_WIN32_WINNT=0x0501 -DWINVER=0x0501
for a list of Windows version: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx
b) To solve the "undefined reference to `WSAStartup@8'" errors, added the library wsock32 (ie: -lwsock32)
转载于:https://blog.51cto.com/bhlzlx/1178462