From a411b1084cb67b49bdf1768b537fcfc0d6792fd9 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 27 Oct 2015 08:51:38 -0700 Subject: [PATCH] Add WSA initializer to handle winderp --- src/Athena/Socket.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Athena/Socket.cpp b/src/Athena/Socket.cpp index df60f9d..f1f784d 100644 --- a/src/Athena/Socket.cpp +++ b/src/Athena/Socket.cpp @@ -49,5 +49,23 @@ void Socket::setBlocking(bool blocking) sock_set_blocking(m_handle, blocking); } +#if _WIN32 +struct WSADerpHandler +{ + WSADerpHandler() + { + WSADATA init; + WSAStartup(MAKEWORD(2, 2), &init); + } + + ~WSADerpHandler() + { + WSACleanup(); + } +}; + +static const WSADerpHandler __wsaderp__; +#endif + } }