Set socket's state to non-blocking on Windows

This commit is contained in:
Aaro Altonen 2020-03-06 07:33:06 +02:00
parent 1b684381d7
commit 3c197ceb15
1 changed files with 4 additions and 1 deletions

View File

@ -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