blob: 1770a05670e3b37d6534773d5631274e2c7da815 (
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
|
#pragma once
#include <vector>
#include <memory>
#include <mutex>
#include "client.hpp"
//since this will be running on our vps we dont need string encryption or protection for anything
//which is cool, i guess
namespace server
{
class c_server {
std::mutex m_mutex;
// vectors are NOT thread safe.
std::vector< std::shared_ptr< c_client > > m_clients;
WSADATA m_sock_data{ };
SOCKET m_socket{ };
public:
~c_server( ) {
if( m_socket )
closesocket( m_socket );
}
int init( );
void listen( );
void client_loop( );
};
}
extern server::c_server g_server;
|