-
Notifications
You must be signed in to change notification settings - Fork 179
Description
I bet no one in the real world has used clickhouse-cpp on windows, not even for testing.
Using the following code on windows results in an error code: WSAHOST_NOT_FOUND
clickhouse-cpp/clickhouse/base/socket.cpp
Line 194 in de70d97
hints.ai_flags |= AI_ADDRCONFIG; |
So it will crash here
clickhouse-cpp/clickhouse/base/socket.cpp
Line 200 in de70d97
throw std::system_error(getSocketErrorCode(), getErrorCategory()); |
we need
#if defined(_unix_)
if (!Singleton<LocalNames>()->IsLocalName(host)) {
// https://linux.die.net/man/3/getaddrinfo
// If hints.ai_flags includes the AI_ADDRCONFIG flag,
// then IPv4 addresses are returned in the list pointed to by res only
// if the local system has at least one IPv4 address configured,
// and IPv6 addresses are only returned if the local system
// has at least one IPv6 address configured.
// The loopback address is not considered for this case
// as valid as a configured address.
hints.ai_flags |= AI_ADDRCONFIG;
}
#endif
At the same time, I don't know why windows can never receive database messages here,
clickhouse-cpp/clickhouse/base/socket.cpp
Line 335 in de70d97
const ssize_t ret = ::recv(s_, (char*)buf, (int)len, 0); |
so inevitably it crashes in the code behind
clickhouse-cpp/clickhouse/base/socket.cpp
Line 342 in de70d97
throw std::system_error(getSocketErrorCode(), getErrorCategory(), "closed"); |
By the way I am connecting to the remote ip