22 #ifndef XAPIAN_INCLUDED_SOCKET_UTILS_H
23 #define XAPIAN_INCLUDED_SOCKET_UTILS_H
37 extern HANDLE fd_to_handle(
int fd);
55 struct WinsockInitializer {
56 WinsockInitializer() {
58 int wsaerror = WSAStartup(MAKEWORD(2, 2), &wsadata);
67 ~WinsockInitializer() {
81 int wsa_err = WSAGetLastError();
84 case WSAEADDRINUSE:
return EADDRINUSE;
87 case WSAETIMEDOUT:
return ETIMEDOUT;
90 case WSAEINPROGRESS:
return EINPROGRESS;
92 default:
return wsa_err;
100 # define EADDRINUSE WSAEADDRINUSE
103 # define ETIMEDOUT WSAETIMEDOUT
106 # define EINPROGRESS WSAEINPROGRESS
111 # define CLOSESOCKET(S) closesocket(S)
116 #include <arpa/inet.h>
123 # define CLOSESOCKET(S) close(S)
138 (INET6_ADDRSTRLEN > INET_ADDRSTRLEN ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN);
Indicates a problem communicating with a remote database.
Hierarchy of classes which Xapian can throw as exceptions.
include <netdb.h>, with portability workarounds.
<unistd.h>, but with compat.
include <winsock2.h> but working around problems.
void set_socket_timeouts(int fd, double timeout)
Attempt to set socket-level timeouts.
void close_fd_or_socket(int fd)
int pretty_ip6(const void *p, char *buf)
constexpr size_t PRETTY_IP6_LEN