From 316934d7f2f17ddcf52b25cee16bf600da426be2 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 23 Aug 2018 21:05:40 +0300 Subject: [PATCH] Enable ReadFile to block when reading from socket --- src/debug/netcoredbg/platform.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/debug/netcoredbg/platform.cpp b/src/debug/netcoredbg/platform.cpp index 3a940a6..90e0916 100644 --- a/src/debug/netcoredbg/platform.cpp +++ b/src/debug/netcoredbg/platform.cpp @@ -392,7 +392,10 @@ SOCKET IORedirectServerHandles::WaitForConnection(uint16_t port) return INVALID_SOCKET; } - m_sockFd = ::socket(AF_INET, SOCK_STREAM, 0); + // Use WSASocket with 0 flags to create a socket without FILE_FLAG_OVERLAPPED. + // This enables the ReadFile function to block on reading from accepted socket. + DWORD dwFlags = 0; + m_sockFd = WSASocket(AF_INET, SOCK_STREAM, 0, NULL, 0, dwFlags); if (m_sockFd == INVALID_SOCKET) { WSACleanup(); -- 2.7.4