From 79594279da40abb68c6f15db2015f029c36f9c4e Mon Sep 17 00:00:00 2001 From: ayeteadoe Date: Mon, 14 Jul 2025 15:21:40 -0700 Subject: [PATCH] LibCore: Make TCPServer::set_blocking() unsupported on Windows Winsock2 doesn't seem to support blocking sockets, or at least not in the naiive way. --- Libraries/LibCore/TCPServerWindows.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Libraries/LibCore/TCPServerWindows.cpp b/Libraries/LibCore/TCPServerWindows.cpp index 41d941fa3ce..4161314aabe 100644 --- a/Libraries/LibCore/TCPServerWindows.cpp +++ b/Libraries/LibCore/TCPServerWindows.cpp @@ -68,9 +68,12 @@ ErrorOr TCPServer::listen(IPv4Address const& address, u16 port, AllowAddre return {}; } -ErrorOr TCPServer::set_blocking(bool blocking) +ErrorOr TCPServer::set_blocking(bool const blocking) { - TRY(Core::System::ioctl(m_fd, FIONBIO, blocking ? 0 : 1)); + // NOTE: Blocking does not seem to be supported. Error code returned is WSAEINVAL + if (!blocking) + return Error::from_string_literal("Core::TCPServer: WinSock2 does not support blocking"); + TRY(Core::System::ioctl(m_fd, FIONBIO, 1)); return {}; }