You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
651 B

#ifndef __BETACORE_SERVER_HPP__
#define __BETACORE_SERVER_HPP__
#include <vector>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <thread>
#include <utility>
#include <functional>
namespace betacore
{
class Server
{
private:
bool online = false;
bool server_running= false;
int port;
int server_socket;
std::vector<int> clients;
char buffer[1024];
struct sockaddr_in server_address;
std::vector<sockaddr_in> client_socket_collection;
void start();
void shutdown();
void listener();
void read_socket(int client);
public:
Server(int port);
void off();
bool running();
};
} // namespace betacore
#endif