SQCSimulator2023/SQCSim-srv/server.h

36 lines
592 B
C
Raw Normal View History

2023-09-24 11:07:03 -04:00
#ifndef SERVER_H__
#define SERVER_H__
2023-09-24 08:45:40 -04:00
#include <fstream>
#include <vector>
#include <string>
#include "../SQCSim-common/world.h"
#include "define.h"
2023-09-24 11:07:03 -04:00
#include "connection.h"
2023-09-24 08:45:40 -04:00
class Server {
public:
2023-09-24 11:07:03 -04:00
Server(LogDest log = LOG_DEST::CONSOLE);
2023-09-24 08:45:40 -04:00
~Server();
int Init();
int Ready();
void Run();
private:
#ifdef _WIN32
WSADATA m_wsaData;
#endif
SOCKET m_sock_udp = 0,
m_sock_tcp = 0;
LogDest m_log;
std::ofstream m_logfile;
2023-09-24 11:07:03 -04:00
Connection* m_conn[MAX_CONNECTIONS];
2023-09-24 08:45:40 -04:00
World* m_world = nullptr;
std::string Timestamp();
void Log(std::string str, bool is_error, bool is_fatal);
};
#endif