From e916a3c85a16e888e0b1ca0a35df69950ca9dd48 Mon Sep 17 00:00:00 2001 From: Vojtech Frodl Date: Wed, 17 Dec 2025 11:19:13 +0100 Subject: [PATCH] wait for data before async recv --- microprofile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/microprofile.cpp b/microprofile.cpp index d2e273d..3a81b3c 100644 --- a/microprofile.cpp +++ b/microprofile.cpp @@ -8813,6 +8813,10 @@ bool MicroProfileWebServerUpdate() MicroProfileWebSocketFrame(); if(!MP_INVALID_SOCKET(Connection)) { + fd_set readfds; + FD_ZERO(&readfds); + FD_SET(Connection, &readfds); + select(0, &readfds, NULL, NULL, NULL); std::lock_guard Lock(MicroProfileMutex()); char Req[8192]; int nReceived = recv(Connection, Req, sizeof(Req) - 1, 0);