blob: bf8404d64f5c1bee2f5d83da0a34c3ebded0b00e (
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
|
#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;
}
|