From c4f4eda3474bceff61fa275c416e57fe8a3de7fa Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 17 Jan 2014 12:38:25 +0100 Subject: ProtoProxy: Fixed compilation in Windows and in Linux. --- Tools/ProtoProxy/Server.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Tools/ProtoProxy/Server.cpp') diff --git a/Tools/ProtoProxy/Server.cpp b/Tools/ProtoProxy/Server.cpp index 35732764c..aa5b74a2a 100644 --- a/Tools/ProtoProxy/Server.cpp +++ b/Tools/ProtoProxy/Server.cpp @@ -22,13 +22,16 @@ cServer::cServer(void) int cServer::Init(short a_ListenPort, short a_ConnectPort) { m_ConnectPort = a_ConnectPort; - WSAData wsa; - int res = WSAStartup(0x0202, &wsa); - if (res != 0) - { - printf("Cannot initialize WinSock: %d\n", res); - return res; - } + + #ifdef _WIN32 + WSAData wsa; + int res = WSAStartup(0x0202, &wsa); + if (res != 0) + { + printf("Cannot initialize WinSock: %d\n", res); + return res; + } + #endif // _WIN32 printf("Generating protocol encryption keypair...\n"); time_t CurTime = time(NULL); @@ -62,7 +65,7 @@ void cServer::Run(void) while (true) { sockaddr_in Addr; - ZeroMemory(&Addr, sizeof(Addr)); + memset(&Addr, 0, sizeof(Addr)); int AddrSize = sizeof(Addr); SOCKET client = accept(m_ListenSocket, (sockaddr *)&Addr, &AddrSize); if (client == INVALID_SOCKET) -- cgit v1.2.3 From 1aeecdbe43fbcd839e3a4927bfad9a5d8ae5dad7 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 17 Jan 2014 13:15:54 +0100 Subject: ProtoProxy: Compiles under Linux. --- Tools/ProtoProxy/Server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Tools/ProtoProxy/Server.cpp') diff --git a/Tools/ProtoProxy/Server.cpp b/Tools/ProtoProxy/Server.cpp index aa5b74a2a..71b5ecb94 100644 --- a/Tools/ProtoProxy/Server.cpp +++ b/Tools/ProtoProxy/Server.cpp @@ -66,11 +66,11 @@ void cServer::Run(void) { sockaddr_in Addr; memset(&Addr, 0, sizeof(Addr)); - int AddrSize = sizeof(Addr); + socklen_t AddrSize = sizeof(Addr); SOCKET client = accept(m_ListenSocket, (sockaddr *)&Addr, &AddrSize); if (client == INVALID_SOCKET) { - printf("accept returned an error: %d; bailing out.\n", WSAGetLastError()); + printf("accept returned an error: %d; bailing out.\n", SocketError); return; } printf("Client connected, proxying...\n"); -- cgit v1.2.3