48 # include <netinet/in.h>    49 # include <netinet/tcp.h>    56                        double timeout_connect, 
bool tcp_nodelay)
    59     int connect_errno = 0;
    60     for (
auto&& r : 
Resolver(hostname, port)) {
    63         socktype |= SOCK_NONBLOCK;
    65         int fd = socket(r.ai_family, socktype, r.ai_protocol);
    69 #if !defined __WIN32__ && defined F_SETFD && defined FD_CLOEXEC    74             (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
    80         int rc = ioctlsocket(fd, FIONBIO, &enabled);
    81 #define FLAG_NAME "FIONBIO"    82 #elif defined O_NONBLOCK    83         int rc = fcntl(fd, F_SETFL, O_NONBLOCK);
    84 #define FLAG_NAME "O_NONBLOCK"    86         int rc = fcntl(fd, F_SETFL, O_NDELAY);
    87 #define FLAG_NAME "O_NDELAY"   102             if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
   103                            reinterpret_cast<char *>(&optval),
   104                            sizeof(optval)) < 0) {
   111         int retval = connect(fd, r.ai_addr, r.ai_addrlen);
   120             WSAGetLastError() == WSAEWOULDBLOCK
   130             fds.events = POLLOUT;
   132                 retval = poll(&fds, 1, 
int(timeout_connect * 1000));
   133             } 
while (retval < 0 && (errno == EINTR || errno == EAGAIN));
   142                 retval = select(fd + 1, 0, &fdset, 0, &tv);
   143             } 
while (retval < 0 && (errno == EINTR || errno == EAGAIN));
   147                 int saved_errno = errno;
   151                                                "select() on socket failed)",
   161             retval = getsockopt(fd, SOL_SOCKET, SO_ERROR,
   162                                 reinterpret_cast<char *>(&err), &len);
   179         if (connect_errno == 0)
   186     if (socketfd == -1) {
   192     ioctlsocket(socketfd, FIONBIO, &enabled);
   194     fcntl(socketfd, F_SETFL, 0);
 Open a TCP connection to a server. 
 
RemoteConnection class used by the remote backend. 
 
include <sys/select.h> with portability workarounds. 
 
Indicates a timeout expired while communicating with a remote database. 
 
include <sys/socket.h> with portability workarounds. 
 
Convert types to std::string. 
 
include <netdb.h>, with portability workarounds. 
 
Hierarchy of classes which Xapian can throw as exceptions. 
 
Resolve hostnames and ip addresses. 
 
Socket handling utilities. 
 
int open_socket(const std::string &hostname, int port, double timeout_connect, bool tcp_nodelay)
Attempt to open a TCP/IP socket connection to a server. 
 
Indicates a problem communicating with a remote database. 
 
void to_timeval(double t, struct timeval *tv)
Fill in struct timeval from number of seconds in a double. 
 
Functions for handling a time or time interval in a double. 
 
include <fcntl.h>, but working around broken platforms.