diff --git a/lib/tcp_socket.hpp b/lib/tcp_socket.hpp index 2d42539..a70032c 100644 --- a/lib/tcp_socket.hpp +++ b/lib/tcp_socket.hpp @@ -39,6 +39,7 @@ class server { #if __linux__ int sock; #elif _WIN32 + WSADATA wsa; SOCKET sock; #endif struct sockaddr_in addr; @@ -79,6 +80,7 @@ class client { #if __linux__ int conn; // mijenja sock #elif _WIN32 + WSADATA wsa; SOCKET conn; // mijenja sock #endif struct sockaddr_in addr; diff --git a/src/tcp_socket.cpp b/src/tcp_socket.cpp index fd26359..66ae272 100644 --- a/src/tcp_socket.cpp +++ b/src/tcp_socket.cpp @@ -12,7 +12,6 @@ server::server (const ushort port, const uint limit, SSL_CTX* _securefds) { addr.sin_port = htons(port); #if _WIN32 - WSADATA wsa; if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) { throw string("[ERROR] WSA Startup. Detail: " + to_string(WSAGetLastError())); } @@ -144,7 +143,6 @@ secure::~secure () { client::client(const string address, const ushort port, const uint timeout, SSL_CTX* securefds) { #if _WIN32 - WSADATA wsa; if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) { throw string("[ERROR] Unable to set WinSock " + to_string(WSAGetLastError())); } @@ -180,9 +178,6 @@ client::client(const string address, const ushort port, const uint timeout, SSL_ } #endif - - - if (securefds) { ssl = SSL_new(securefds); if (!ssl) { diff --git a/test/client.exe b/test/client.exe index 1e2cb70..1fb9cca 100644 Binary files a/test/client.exe and b/test/client.exe differ diff --git a/test/server.exe b/test/server.exe index 6ef2399..950adeb 100644 Binary files a/test/server.exe and b/test/server.exe differ