File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/dds.net-connector-cpp.lib/connector/src/internal/src Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,15 @@ using namespace dds::net::connector;
1616using namespace dds ::net::connector::_internal;
1717
1818
19+
20+ #if TARGET_PLATFORM == PLATFORM_WINDOWS
21+
22+ static int wsaStartCount = 0 ;
23+
24+ #endif
25+
26+
27+
1928dds::net::connector::_internal::
2029 NetworkClient::NetworkClient (
2130 Logger* logger,
@@ -50,18 +59,27 @@ dds::net::connector::_internal::
5059
5160 memset (&this ->targetSocketAddress , 0 , sizeof (this ->targetSocketAddress ));
5261
62+
63+
5364#if TARGET_PLATFORM == PLATFORM_WINDOWS
5465
66+ if (wsaStartCount == 0 )
67+ {
5568 WSADATA wsaData;
69+
5670 int windowsStartupResult = WSAStartup (MAKEWORD (2 , 2 ), &wsaData);
71+
5772 if (windowsStartupResult != 0 )
5873 {
59- std::string msg = " WSAStartup failed with return code: " ;
74+ std::string msg = " WSAStartup failed with error code: " ;
6075 msg += windowsStartupResult;
6176
6277 this ->logger ->error (msg.c_str ());
6378 return ;
6479}
80+ }
81+
82+ wsaStartCount++;
6583
6684#endif
6785}
You can’t perform that action at this time.
0 commit comments