diff options
| author | boris <wzn@moneybot.cc> | 2018-12-19 00:13:24 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-12-19 00:13:24 +1300 |
| commit | 77b52da44b263df4884be2f35f885d8edccbb6fa (patch) | |
| tree | 54a9a07c67d507cb5120ae7e4ee86669dfec7c6b /csgo-loader/csgo-client/Networking/TCPClient.hpp | |
| parent | 1270999026bd77165edfffebfce277a34761710c (diff) | |
added new loader project :)
merry christmas
Diffstat (limited to 'csgo-loader/csgo-client/Networking/TCPClient.hpp')
| -rw-r--r-- | csgo-loader/csgo-client/Networking/TCPClient.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/csgo-loader/csgo-client/Networking/TCPClient.hpp b/csgo-loader/csgo-client/Networking/TCPClient.hpp new file mode 100644 index 0000000..f057cdc --- /dev/null +++ b/csgo-loader/csgo-client/Networking/TCPClient.hpp @@ -0,0 +1,39 @@ +#pragma once
+
+// For encryption wrappers.
+#include <Security/Encryption.hpp>
+
+// WinSocks
+#include <winsock2.h>
+#pragma comment(lib, "ws2_32.lib")
+
+// std::min
+#include <algorithm>
+
+namespace Networking {
+ // A TCPClient is essentially the same as the TCPConnection counterpart on the server,
+ // however, it independently handles connection.
+ class TCPClient {
+ WSADATA m_WinSocks;
+ SOCKET m_Socket;
+ sockaddr_in m_Context;
+ Wrapper::Encryption m_Encryption;
+
+ public:
+ TCPClient() = default;
+
+ // Connects to a remote server.
+ // Also handles the initial handshake between server and client.
+ bool Start(uint32_t ServerAddress, uint16_t ServerPort);
+
+ // Kills the client.
+ void Kill();
+
+ // Wrappers for sending/receiving data.
+ void SendRawBytes(ByteArray &Bytes);
+ ByteArray ReceiveRawBytes();
+
+ void SendBytes(ByteArray &Bytes);
+ ByteArray ReceiveBytes();
+ };
+}
\ No newline at end of file |
