It wants to get included before windows.h
+#ifdef WIN32
+#include <winsock2.h>
+#endif
#include <cerrno>
#include <msp/core/systemerror.h>
#include <msp/io/handle_private.h>
-#ifndef WIN32
+#ifdef WIN32
+#include <winsock2.h>
+#else
#include <cerrno>
#include <unistd.h>
#include <fcntl.h>
+#ifdef WIN32
+#include <winsock2.h>
+#endif
#include <cerrno>
#include <msp/core/refptr.h>
#include <msp/core/systemerror.h>
-#ifndef WIN32
+#ifdef WIN32
+#include <winsock2.h>
+#else
#include <sys/socket.h>
#endif
#include <cerrno>