source: sock.h @ 5357525

Last change on this file since 5357525 was b7d3cc34, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-11-06T18:23:18Z

Initial repository (0.99 release tree)

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