-
Notifications
You must be signed in to change notification settings - Fork 2
/
ATDMasterServer.cpp
39 lines (30 loc) · 1011 Bytes
/
ATDMasterServer.cpp
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
38
39
// ATDMasterServer.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms.
//
#include <memory>
#include "RakPeerInterface.h"
#include "stdafx.h"
using namespace RakNet;
using namespace std;
int main()
{
printf("#############################\n");
printf("ATD Master Server V0.0.1\n");
printf("#############################\n");
printf("\n");
printf("Starting ATD master server...\n");
RakPeerInterface* rakPeer = RakPeerInterface::GetInstance();
const unique_ptr<NATServer> nat = make_unique<NATServer>(rakPeer);
const unique_ptr <ServerBrowser> browser = make_unique<ServerBrowser>(rakPeer);
SocketDescriptor sd(SocketDescriptor(SERVER_BROWSER_PORT, nullptr));
StartupResult hres = rakPeer->Startup(8096, &sd, 1);
if (hres != RAKNET_STARTED) {
printf("Error while starting the server! Reason: %d\n", hres);
//__debugbreak();
return -1;
}
nat->StartServer();
browser->StartServer();
while(true) {
browser->ProcessMessages();
}
}