+ if(fd < 0)
+ return -1;
+
+ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+ setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
+
+ return connect(fd, addr, addrlen);
+}
+
+static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port)
+{
+ int fd = -1;
+#if HAVE_GETADDRINFO
+ struct addrinfo hints;
+ char service[6]; /* "65535" with the trailing '\0' */
+ struct addrinfo *results, *addr;
+ char *bracket;
+#endif
+
+ if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol)
+#ifdef AF_INET6
+ && strcmp("inet6",protocol)
+#endif
+ )