-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathServerMain.cpp
More file actions
34 lines (24 loc) · 698 Bytes
/
ServerMain.cpp
File metadata and controls
34 lines (24 loc) · 698 Bytes
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
#include "ServerInterface.h"
#include "FileManager.h"
#include <csignal>
bool abortApp = false;
void SignalHandler(int signal) {
abortApp = true;
}
int main() {
signal(SIGINT, SignalHandler);
ServerInterface server(5454, 4820); // make a tcp server on port 5454 and start it
Server tcp = server.GetTCPServer();
Server udp = server.GetUDPServer();
std::cout << "Created TCP and UDP servers" << std::endl;
server.StartServer(tcp);
server.StartServer(udp);
while ( 1 ) {
if ( abortApp ) {
server.~ServerInterface();
return 0;
}
std::this_thread::sleep_for(std::chrono::seconds(1));
}
return 0;
}