From 3c197ceb1571e4bb02e1d0fa528dc555ba04b6df Mon Sep 17 00:00:00 2001 From: Aaro Altonen Date: Fri, 6 Mar 2020 07:33:06 +0200 Subject: [PATCH] Set socket's state to non-blocking on Windows --- src/media_stream.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/media_stream.cc b/src/media_stream.cc index 132da76..032296b 100644 --- a/src/media_stream.cc +++ b/src/media_stream.cc @@ -42,7 +42,10 @@ rtp_error_t kvz_rtp::media_stream::init_connection() return ret; #ifdef _WIN32 - if (::ioctlsocket(socket_.get_raw_socket(), FIONREAD, nullptr) < 0) + /* Make the socket non-blocking */ + int enabled = 1; + + if (::ioctlsocket(socket_.get_raw_socket(), FIONBIO, (char *)&enabled) < 0) LOG_ERROR("Failed to make the socket non-blocking!"); #endif