summaryrefslogtreecommitdiffstats
path: root/Tools/ProtoProxy/Server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/ProtoProxy/Server.cpp')
-rw-r--r--Tools/ProtoProxy/Server.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/Tools/ProtoProxy/Server.cpp b/Tools/ProtoProxy/Server.cpp
index 35732764c..71b5ecb94 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,12 +65,12 @@ void cServer::Run(void)
while (true)
{
sockaddr_in Addr;
- ZeroMemory(&Addr, sizeof(Addr));
- int AddrSize = sizeof(Addr);
+ memset(&Addr, 0, 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");