diff --git a/src/Platform.h b/src/Platform.h index f579a36..e12395e 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -32,6 +32,7 @@ #include #include #include +#include #else #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #endif #ifdef _WIN32 diff --git a/src/PlatformSockets.c b/src/PlatformSockets.c index 01c0c10..7820e90 100644 --- a/src/PlatformSockets.c +++ b/src/PlatformSockets.c @@ -299,11 +299,13 @@ int setSocketNonBlocking(SOCKET s, bool enabled) { #if defined(__vita__) int val = enabled ? 1 : 0; return setsockopt(s, SOL_SOCKET, SO_NONBLOCK, (char*)&val, sizeof(val)); +#elif defined(O_NONBLOCK) + return fcntl(s, F_SETFL, (enabled ? O_NONBLOCK : 0) | (fcntl(s, F_GETFL) & ~O_NONBLOCK)); #elif defined(FIONBIO) int val = enabled ? 1 : 0; return ioctlsocket(s, FIONBIO, &val); #else - return SOCKET_ERROR; +#error Please define your platform's non-blocking sockets API! #endif }