diff --git a/c/opendht_c.h b/c/opendht_c.h
index 137193d36a77beb483442eea8182a8a99bd2cedc..b7618371bcfc8c0e146fe1b5bb025d49b1fd9250 100644
--- a/c/opendht_c.h
+++ b/c/opendht_c.h
@@ -23,12 +23,21 @@ extern "C" {
 #endif
 
 #include <opendht/def.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+
 #include <stdbool.h>
 #include <stdint.h>
 #include <stddef.h>
 
+#ifdef _WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+typedef uint16_t sa_family_t;
+typedef uint16_t in_port_t;
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#endif
+
 // Non-owning data view
 struct OPENDHT_C_PUBLIC dht_data_view {
     const uint8_t* data;