bettola/server/src/main.cpp

25 lines
520 B
C++

#include <cstdio>
#include <exception>
#include <thread>
#include <chrono>
#include "network_manager.h"
#include "net/constants.h"
int main(int argc, char** argv) {
try {
/* We'll keep main thread alive while server runs in background. */
NetworkManager server;
server.start(MULTIPLAYER_PORT);
while(true) {
std::this_thread::sleep_for(std::chrono::seconds(1));
}
} catch(const std::exception& e) {
fprintf(stderr, "Main exception: %s\n", e.what());
return 1;
}
return 0;
}