(net_http.c) Add Win32 alternative for fcntl

This commit is contained in:
twinaphex 2015-01-23 08:07:15 +01:00
parent 61776c5175
commit ce0edc7647

View File

@ -79,7 +79,9 @@ static bool net_http_parse_url(char *url, char **domain,
static int net_http_new_socket(const char * domain, int port) static int net_http_new_socket(const char * domain, int port)
{ {
int fd, i = 1; int fd, i = 1;
#ifndef _WIN32 #ifdef _WIN32
u_long mode = 1;
#else
struct timeval timeout; struct timeval timeout;
#endif #endif
struct addrinfo hints, *addr = NULL; struct addrinfo hints, *addr = NULL;
@ -113,9 +115,11 @@ static int net_http_new_socket(const char * domain, int port)
freeaddrinfo_rarch(addr); freeaddrinfo_rarch(addr);
#ifdef __CELLOS_LV2__ #if defined(__CELLOS_LV2__)
setsockopt(fd, SOL_SOCKET, SO_NBIO, &i, sizeof(int)); setsockopt(fd, SOL_SOCKET, SO_NBIO, &i, sizeof(int));
setsockopt(fd, SOL_SOCKET, SO_NBIO, &i, sizeof(int)); setsockopt(fd, SOL_SOCKET, SO_NBIO, &i, sizeof(int));
#elif defined(_WIN32)
ioctlsocket(fd, FIONBIO, &mode);
#else #else
fcntl(fd, F_SETFL, O_NONBLOCK); fcntl(fd, F_SETFL, O_NONBLOCK);
fcntl(fd, F_SETFL, O_NONBLOCK); fcntl(fd, F_SETFL, O_NONBLOCK);