-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.hpp
37 lines (30 loc) · 850 Bytes
/
server.hpp
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
#ifndef A0C38058_A8A5_4F50_96AF_9417E822EEF0
#define A0C38058_A8A5_4F50_96AF_9417E822EEF0
#include <iostream>
#include <string>
#include <array>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <cstring>
#include <algorithm>
class serverhandel{
private:
int socket_fd;
int client_socket_fd;
std::array<char,50000> buffer;
public:
serverhandel();
~serverhandel();
bool server_init();
bool server_lisen();
bool server_accept_client();
bool server_send_msg(const std::string& message);
void close_listening();
void close_listening_client();
void trim_end(std::string& str);
std::string server_read();
void server_close();
};
#endif /* A0C38058_A8A5_4F50_96AF_9417E822EEF0 */