diff options
Diffstat (limited to 'NetEx')
-rw-r--r-- | NetEx/NetClient.cpp | 31 | ||||
-rw-r--r-- | NetEx/NetClient.h | 22 |
2 files changed, 30 insertions, 23 deletions
diff --git a/NetEx/NetClient.cpp b/NetEx/NetClient.cpp index a334d64..8c9ee51 100644 --- a/NetEx/NetClient.cpp +++ b/NetEx/NetClient.cpp @@ -3,32 +3,39 @@ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors Copyright (c) 1997-2006, Destroyer Studios LLC. - AUTHOR: John DiCamillo + AUTHOR: John DiCamillo - OVERVIEW - ======== - Network Server Pump for HTTP Server + OVERVIEW + ======== + Network Server Pump for HTTP Server */ #include "NetClient.h" -#include "NetHost.h" + +#include <windows.h> + +#include "NetAddr.h" +#include "NetSock.h" #include "NetLayer.h" -#include <mmsystem.h> -// +-------------------------------------------------------------------+ -NetClient::NetClient(const NetAddr& server_addr) - : addr(server_addr), sock(0), delta(0), time(0), err(0) +NetClient::NetClient(const NetAddr& server_addr) : + addr(server_addr), + sock(nullptr), + delta(0), + time(0), + err(0) { } + NetClient::~NetClient() { - delete sock; + if (sock) + delete sock; } -// +--------------------------------------------------------------------+ bool NetClient::Send(Text msg) @@ -69,6 +76,7 @@ NetClient::Send(Text msg) return false; } + Text NetClient::Recv() { @@ -100,6 +108,7 @@ NetClient::Recv() return response; } + Text NetClient::SendRecv(Text msg) { diff --git a/NetEx/NetClient.h b/NetEx/NetClient.h index 0d5755e..5bd7d10 100644 --- a/NetEx/NetClient.h +++ b/NetEx/NetClient.h @@ -3,25 +3,23 @@ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors Copyright (c) 1997-2006, Destroyer Studios LLC. - AUTHOR: John DiCamillo + AUTHOR: John DiCamillo - OVERVIEW - ======== - Stream-oriented network client class + OVERVIEW + ======== + Stream-oriented network client class */ - #ifndef NetClient_h #define NetClient_h -#include <windows.h> +#include <cstdint> + #include "NetAddr.h" -#include "NetGram.h" #include "NetSock.h" -#include "List.h" +#include "Text.h" -// +-------------------------------------------------------------------+ class NetClient { @@ -40,13 +38,13 @@ public: Text SendRecv(Text msg); int GetLastError() const { return err; } - DWORD GetTime() const { return delta; } + std::uint32_t GetTime() const { return delta; } protected: NetAddr addr; NetSock* sock; - DWORD delta; - DWORD time; + std::uint32_t delta; + std::uint32_t time; int err; public: |