Skip to content

Commit 6d014fb

Browse files
committed
Fix Stratum Connection Bug on Windows
Really no idea why it is suddenly needed... Signed-off-by: Pttn <28868425+Pttn@users.noreply.github.com>
1 parent dc98d0f commit 6d014fb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

StratumClient.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,15 @@ void StratumClient::connect() {
256256
_state = INIT;
257257
_result = std::string();
258258

259+
#ifdef _WIN32
260+
WORD wVersionRequested(MAKEWORD(2, 2));
261+
WSADATA wsaData;
262+
int err(WSAStartup(wVersionRequested, &wsaData));
263+
if (err != 0) {
264+
ERRORMSG("WSAStartup failed with error: " << err);
265+
return;
266+
}
267+
#endif
259268
hostent* hostInfo = gethostbyname(_host.c_str());
260269
if (hostInfo == nullptr) {
261270
std::cout << __func__ << ": unable to resolve '" << _host << "'. Check the URL or your connection." << std::endl;

0 commit comments

Comments
 (0)