Début sockets.

This commit is contained in:
MarcEricMartel
2023-09-24 08:45:40 -04:00
parent b7ca0253ca
commit 51b0795c62
11 changed files with 455 additions and 45 deletions

34
SQCSim-srv/server.h Normal file
View File

@@ -0,0 +1,34 @@
#ifndef _SERVER_H__
#define _SERVER_H__
#include <fstream>
#include <vector>
#include <string>
#include "../SQCSim-common/world.h"
#include "define.h"
class Server {
public:
Server(LogDest log = LogDest::CONSOLE);
~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;
World* m_world = nullptr;
std::vector<Player> m_players;
std::string Timestamp();
void Log(std::string str, bool is_error, bool is_fatal);
};
#endif