From 305f437f74d5fd538a98ef0258e03d604654c3e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Sun, 8 Jun 2025 18:46:54 -0400
Subject: [PATCH] c: use appropriate includes for Windows

---
 c/opendht_c.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/c/opendht_c.h b/c/opendht_c.h
index 137193d3..b7618371 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;
-- 
GitLab