source: sock.h @ 238f828

Last change on this file since 238f828 was 8a9afe4, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-12-17T16:54:12Z

http_client lib

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#include <errno.h>
2#include <fcntl.h>
3
4#ifndef _WIN32
5#include <unistd.h>
6#include <sys/socket.h>
7#include <netinet/in.h>
8#include <arpa/inet.h>
9#include <netdb.h>
10#define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK)
11#define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0)
12#define sockerr_again() (errno == EINPROGRESS || errno == EINTR)
13#define closesocket(a) close(a)
14#else
15# include <winsock2.h>
16# ifndef _MSC_VER
17#  include <ws2tcpip.h>
18# endif
19# if !defined(BITLBEE_CORE) && defined(_MSC_VER)
20#   pragma comment(lib,"bitlbee.lib")
21# endif
22# include <io.h>
23# define read(a,b,c) recv(a,b,c,0)
24# define write(a,b,c) send(a,b,c,0)
25# define umask _umask
26# define mode_t int
27# define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); }
28# define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); }
29# define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK)
30# define ETIMEDOUT WSAETIMEDOUT
31# define sleep(a) Sleep(a*1000)
32#endif
Note: See TracBrowser for help on using the repository browser.