Files
irc/Server/Server.hpp

49 lines
1.5 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Server.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/04/13 22:31:44 by aortigos #+# #+# */
/* Updated: 2026/04/13 22:31:44 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SERVER_HPP
# define SERVER_HPP
# include <iostream>
# include <cstdlib>
# include <sys/socket.h>
# include <netinet/in.h>
# include <unistd.h>
# include <vector>
# include <poll.h>
# include "../Client/Client.hpp"
# include <map>
class Server
{
private:
int port;
std::string password;
int server_fd;
std::vector<pollfd> fds;
std::map<int, Client> clients;
void acceptClient();
void readClient(int fd);
void removeClient(int fd);
public:
Server();
Server(int port, std::string password);
~Server();
int run();
};
#endif