forked from DzZ01/chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServer.h
46 lines (31 loc) · 783 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
43
44
45
46
//
// Created by daimiaopeng on 2019/10/31.
//
#ifndef CHAT_SERVER_H
#define CHAT_SERVER_H
#include "MessageQueue.h"
#include "event_infor.h"
#include "glog/logging.h"
#include <vector>
#include<algorithm>
class Server {
private:
string _ip;
int lfd;
u_int _port;
struct sockaddr_in serv_addr{};
int epoll_fd;
struct event_infor g_events[MAX_EVENTS + 1]{};
MessageQueue *_messageQueue;
public:
Server(string ip, u_int port, const MessageQueue *messageQueue);
void run();
void eventset();
void eventdel();
void initsocket();
void recvdata(event_infor *infor);
void acceptconn(event_infor *infor);
void eventadd(int events, event_infor *infor);
void senddata(event_infor *infor);
};
#endif //CHAT_SERVER_H