diff --git a/src/main/lkt.c b/src/main/lkt.c
index 1b63f7e7525bcc3a24a3d3ef7f41d231e7b0f591..f7eb79266ef39665affb337273a4aed9e9e4f065 100644
--- a/src/main/lkt.c
+++ b/src/main/lkt.c
@@ -313,8 +313,8 @@ write_socket(SOCKET sock, const char *format, ...)
     va_start(ap, format);
     const int size = safe_vsnprintf(buff, LKT_MESSAGE_MAX - 1, format, ap);
 
-    FAIL_IF(size < 0, "Failed to write to temporary buffer");
-    FAIL_IF(fwrite(buff, sizeof(char), (size_t)size, sock) < (unsigned int)size, "Connexion error");
+    FAIL_IF(size <= 0, "Failed to write to temporary buffer");
+    FAIL_IF(send(sock, buff, (size_t)size, 0) < size, "Connexion error");
 
     va_end(ap);
 }