Some clean and test, befor merge

win-support
unknown 1 year ago
parent 2118270646
commit 4388730e9f
  1. 2
      lib/tcp_socket.hpp
  2. 5
      src/tcp_socket.cpp
  3. BIN
      test/client.exe
  4. BIN
      test/server.exe

@ -39,6 +39,7 @@ class server {
#if __linux__ #if __linux__
int sock; int sock;
#elif _WIN32 #elif _WIN32
WSADATA wsa;
SOCKET sock; SOCKET sock;
#endif #endif
struct sockaddr_in addr; struct sockaddr_in addr;
@ -79,6 +80,7 @@ class client {
#if __linux__ #if __linux__
int conn; // mijenja sock int conn; // mijenja sock
#elif _WIN32 #elif _WIN32
WSADATA wsa;
SOCKET conn; // mijenja sock SOCKET conn; // mijenja sock
#endif #endif
struct sockaddr_in addr; struct sockaddr_in addr;

@ -12,7 +12,6 @@ server::server (const ushort port, const uint limit, SSL_CTX* _securefds) {
addr.sin_port = htons(port); addr.sin_port = htons(port);
#if _WIN32 #if _WIN32
WSADATA wsa;
if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) { if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) {
throw string("[ERROR] WSA Startup. Detail: " + to_string(WSAGetLastError())); 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) { client::client(const string address, const ushort port, const uint timeout, SSL_CTX* securefds) {
#if _WIN32 #if _WIN32
WSADATA wsa;
if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) { if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) {
throw string("[ERROR] Unable to set WinSock " + to_string(WSAGetLastError())); 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 #endif
if (securefds) { if (securefds) {
ssl = SSL_new(securefds); ssl = SSL_new(securefds);
if (!ssl) { if (!ssl) {

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save