X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=octopi%2Flibrary%2Fsockets%2Fraw_socket.cpp;h=6fb3d6eaabc520670acaf673f006b8e37e40eea6;hb=18a3e1569cc5f4e87a34938693392231d067763f;hp=97ad00abdddce0eeaca0c8a4c0cad410bddc639a;hpb=19ab994d8ea15bf16ed2f20c651f1a1d5abd12e3;p=feisty_meow.git diff --git a/octopi/library/sockets/raw_socket.cpp b/octopi/library/sockets/raw_socket.cpp index 97ad00ab..6fb3d6ea 100644 --- a/octopi/library/sockets/raw_socket.cpp +++ b/octopi/library/sockets/raw_socket.cpp @@ -126,7 +126,11 @@ int raw_socket::ioctl(basis::un_int socket, int request, void *argp) const return ::ioctl(socket, request, argp); #endif #ifdef __WIN32__ - return ioctlsocket(socket, request, (un_long *)argp); + #ifdef _MSC_VER + return ioctlsocket(socket, request, (un_long *)argp); + #else + return ioctlsocket(socket, request, (un_int *)argp); + #endif #endif } @@ -217,15 +221,23 @@ int raw_socket::inner_select(basis::un_int socket, int mode, int timeout, FD_ZERO(&write_list); FD_SET(socket, &write_list); FD_ZERO(&exceptions); FD_SET(socket, &exceptions); - timeval time_out; - time_stamp::fill_timeval_ms(time_out, timeout); + timeval base_time_out; + time_stamp::fill_timeval_ms(base_time_out, timeout); // timeval has tv_sec=seconds, tv_usec=microseconds. +#if !defined(__GNU_WINDOWS__) + timeval *time_out = &base_time_out; +#elif defined(__GNU_WINDOWS__) + __ms_timeval win_time_out; + win_time_out.tv_sec = base_time_out.tv_sec; + win_time_out.tv_usec = base_time_out.tv_usec; + __ms_timeval *time_out = &win_time_out; +#endif // select will tell us about the socket. int ret = ::select(socket + 1, - (mode & SELECTING_JUST_WRITE)? NIL : &read_list, - (mode & SELECTING_JUST_READ)? NIL : &write_list, - &exceptions, &time_out); + (mode & SELECTING_JUST_WRITE)? NULL_POINTER : &read_list, + (mode & SELECTING_JUST_READ)? NULL_POINTER : &write_list, + &exceptions, time_out); int error = critical_events::system_error(); if (!ret) return 0; // nothing to report. @@ -389,15 +401,23 @@ int raw_socket::select(int_array &read_sox, int_array &write_sox, FD_SET(sock, &write_list); } - timeval time_out; - time_stamp::fill_timeval_ms(time_out, timeout); + timeval base_time_out; + time_stamp::fill_timeval_ms(base_time_out, timeout); // timeval has tv_sec=seconds, tv_usec=microseconds. +#if !defined(__GNU_WINDOWS__) + timeval *time_out = &base_time_out; +#elif defined(__GNU_WINDOWS__) + __ms_timeval win_time_out; + win_time_out.tv_sec = base_time_out.tv_sec; + win_time_out.tv_usec = base_time_out.tv_usec; + __ms_timeval *time_out = &win_time_out; +#endif // select will tell us about the socket. int ret = ::select(highest + 1, - (read_sox.length())? &read_list : NIL, - (write_sox.length())? &write_list : NIL, - &exceptions, &time_out); + (read_sox.length())? &read_list : NULL_POINTER, + (write_sox.length())? &write_list : NULL_POINTER, + &exceptions, time_out); int error = critical_events::system_error(); if (ret == SOCKET_ERROR) {