new class Server

This commit is contained in:
Talyx
2021-12-20 00:25:31 +03:00
parent eb749f6528
commit 61ed01b849
7 changed files with 196 additions and 96 deletions

41
includes/Server.hpp Normal file
View File

@@ -0,0 +1,41 @@
#ifndef SERVER_HPP
#define SERVER_HPP
#include "webserv.hpp"
#define BUFFSIZE 1024
class Server
{
private:
int _port;
int _serverSocket;
int _clientSocket;
// int _bufferSize;
struct sockaddr_in _addres;
std::string _ip;
private:
void checkError(int fd, std::string str);
void sendFile(std::string str);
void sendHeader(void);
void printRed(std::string str);
void printYellow(std::string str);
void printBlue(std::string str);
void printPink(std::string str);
void printGreen(std::string str);
void printTurguoise(std::string str);
public:
Server();
Server(std::string path);
void readConfig(void);
void setupConfig(void);
void start(void);
void end(void);
~Server();
};
#endif

View File

@@ -12,5 +12,8 @@
#include <netinet/in.h>
#include <fcntl.h>
#include <unistd.h>
#include "Server.hpp"
#include <stdlib.h>
#include <fstream>
#endif