summaryrefslogtreecommitdiff
path: root/csgo-loader/csgo-server/Server.cpp
blob: ca6deb4cde5bfdf0e6eda32b9aad595ed6479760 (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
#include <Networking/TCPServer.hpp>
#include <Login/RemoteLogin.hpp>

void ConnectionHandler(Networking::TCPConnection &Connection) {
	Login::RemoteLoginServer LoginServer;

	ByteArray RawLoginHeader = Connection.ReceiveBytes();
	LoginServer.Start(RawLoginHeader);

	ByteArray RawServerResponse = LoginServer.GetResponse();
	Connection.SendBytes(RawServerResponse);
}

int main() {
	Networking::TCPServer Server;

	// Create an instance of the TCP server.
	if(!Server.Start(3884)) {
		printf("[FAIL] Failed to initialise server. (%08lx)\n", WSAGetLastError());
		system("pause");
		return 1;
	}

	// Add a connection handler to the server.
	Server += ConnectionHandler;

	// Accept incoming connections.
	while(true) {
		Server.AcceptConnection();
	}

	return 0;
}