#include #include #ifndef _WIN32 #include #include #include #include #include #define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK) #define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0) #define sockerr_again() (errno == EINPROGRESS || errno == EINTR) #ifndef EVENTS_LIBEVENT #define closesocket(a) close(a) #endif #else # include # ifdef IPV6 # include # endif # if !defined(BITLBEE_CORE) && defined(_MSC_VER) # pragma comment(lib,"bitlbee.lib") # endif # include # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } # define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); } # define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK) # define ETIMEDOUT WSAETIMEDOUT # define sleep(a) Sleep(a*1000) #endif