1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2012 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef _BITCOIN_COMPAT_H
6 #define _BITCOIN_COMPAT_H 1
10 #define MSG_NOSIGNAL 0
11 #define MSG_DONTWAIT 0
12 typedef int socklen_t
;
15 #define WSAGetLastError() errno
16 #define WSAEINVAL EINVAL
17 #define WSAEALREADY EALREADY
18 #define WSAEWOULDBLOCK EWOULDBLOCK
19 #define WSAEMSGSIZE EMSGSIZE
20 #define WSAEINTR EINTR
21 #define WSAEINPROGRESS EINPROGRESS
22 #define WSAEADDRINUSE EADDRINUSE
23 #define WSAENOTSOCK EBADF
24 #define INVALID_SOCKET (SOCKET)(~0)
25 #define SOCKET_ERROR -1
28 inline int myclosesocket(SOCKET
& hSocket
)
30 if (hSocket
== INVALID_SOCKET
)
33 int ret
= closesocket(hSocket
);
35 int ret
= close(hSocket
);
37 hSocket
= INVALID_SOCKET
;
40 #define closesocket(s) myclosesocket(s)