Initial TCP support for Windows

This commit is contained in:
Willem Toorop 2016-01-12 16:54:42 +01:00
parent 61c0a51ec5
commit fed8cc51ed
1 changed files with 8 additions and 4 deletions

View File

@ -390,13 +390,17 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport)
}
return fd;
#endif
printf("fd: %d\n",fd);
if (connect(fd, (struct sockaddr *)&upstream->addr,
upstream->addr_len) == -1) {
if (errno != EINPROGRESS) {
#if USE_WINSOCK
printf("WSAGetLastError(): %d\n", WSAGetLastError());
#endif
if (_getdns_EINPROGRESS || _getdns_EWOULDBLOCK)
return fd;
close(fd);
return -1;
}
}
return fd;
}