-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserver.h
42 lines (35 loc) · 848 Bytes
/
server.h
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
35
36
37
38
39
40
41
42
#ifndef SERVER_H
#define SERVER_H
#include "utils.h"
#include "packet.h"
#include "thread_pool.h"
class Server {
public:
int status;
int server_port;
char *server_addr;
int server_socket;
struct sockaddr_in server_sock_addr;
Packet pkt;
int client_num;
struct sockaddr_in client_sock_addr;
vector<ClientDetails> clients;
vector<pthread_t> tid;
struct ThreadPool tpool;
Server();
Server(const Server&);
friend void swap(Server&, Server&);
Server& operator=(Server);
Server(Server&&);
void begin_thread_pool(int, void*(*thread_func)(void*));
void set_total_connections(int);
void fill_server_details(int, const char*);
void bind_server();
void listen_accept();
void listen_accept(void*(*multithreading_func)(void*));
void connect_with_client();
void read_data();
void write_data();
~Server();
};
#endif //SERVER_H