blob: f5039136b50fedbcd59f25ed19cc709ffd871404 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#pragma once
#include <windows.h>
#include <wininet.h>
#include <vector>
#include <algorithm>
#include <cstdint>
#pragma comment(lib, "wininet.lib")
using ByteArray = std::vector<uint8_t>;
namespace Networking {
// Whenever the handle goes out of scope, it will automatically be released.
class InternetHandle {
HINTERNET m_Internet;
public:
InternetHandle() = default;
InternetHandle(HINTERNET Internet) :
m_Internet(Internet) { }
~InternetHandle() {
InternetCloseHandle(m_Internet);
}
operator HINTERNET() { return m_Internet; };
};
class WebSocket {
InternetHandle m_Internet;
InternetHandle m_Address;
public:
bool Start(const char *Address, const char *Username, const char *Password);
ByteArray Request(const char *File, const char *Header, ByteArray &Data);
};
}
|