-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleServer.h
More file actions
44 lines (34 loc) · 810 Bytes
/
SimpleServer.h
File metadata and controls
44 lines (34 loc) · 810 Bytes
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
//
// Created by jesse_wang on 6/23/17.
// jessejcw@gmail.com
//
#ifndef SIMPLESERVER_SIMPLESERVER_H
#define SIMPLESERVER_SIMPLESERVER_H
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "Worker.h"
#define SRVR_DEFAULT_PORT 9800
class SimpleServer {
//int listen_socket;
int server;
int port_num = SRVR_DEFAULT_PORT;
bool is_exist = false;
char buffer[BUFSIZ];
struct sockaddr_in server_addr;
socklen_t size;
Worker workr;
public:
~SimpleServer();
int get_port_num() const {
return port_num;
}
void set_port_num(int port_num) {
SimpleServer::port_num = port_num;
}
int start();
int startServer(int*);
int createWorkers();
int handleConnect(int);
};
#endif //SIMPLESERVER_SIMPLESERVER_H