-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientConnection.h
More file actions
44 lines (27 loc) · 965 Bytes
/
ClientConnection.h
File metadata and controls
44 lines (27 loc) · 965 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
#if !defined ClientConnection_H
#define ClientConnection_H
#include <pthread.h>
#include <cstdio>
#include <cstdint>
const int MAX_BUFF=1000;
class ClientConnection {
public:
ClientConnection(int s, unsigned long client_addr);
~ClientConnection();
void WaitForRequests();
void stop();
private:
bool ok; // This variable is flag that avois that the
// server listens if initialization errors occured.
FILE *fd; // C file descriptor. We use it to buffer the
// control connection of the socket and allows to
// manage it as a C file usign fprintf, fscanf, etc.
char command[MAX_BUFF]; // Buffer for saving the command.
char arg[MAX_BUFF]; // Buffer for saving the arguments.
int data_socket; // Data socket descriptor;
int control_socket; // Control socket descriptor;
bool parar;
bool passive;
unsigned long client_address;
};
#endif