Skip to content

Commit dce6c7e

Browse files
committed
initializing the socket startup
1 parent 297f9c4 commit dce6c7e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/dds.net-connector-cpp.lib/connector/src/internal/src/network_client.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ dds::net::connector::_internal::
4646

4747
this->ipv4 = "";
4848
this->tcpPort = 0;
49+
this->socketFileDescriptor = -1;
50+
51+
memset(&this->targetSocketAddress, 0, sizeof(this->targetSocketAddress));
52+
53+
#if TARGET_PLATFORM == PLATFORM_WINDOWS
54+
55+
WSADATA wsaData;
56+
int windowsStartupResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
57+
if (windowsStartupResult != 0)
58+
{
59+
std::string msg = "WSAStartup failed with return code: ";
60+
msg += windowsStartupResult;
61+
62+
this->logger->error(msg.c_str());
63+
return;
64+
}
65+
66+
#endif
4967
}
5068

5169
SyncQueueReader<PacketFromServer*>*

0 commit comments

Comments
 (0)