-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHeadsTailsServer.h
More file actions
46 lines (31 loc) · 989 Bytes
/
HeadsTailsServer.h
File metadata and controls
46 lines (31 loc) · 989 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
45
46
#ifndef HEADSTAILS_H
#define HEADSTAILS_H
#include "ServerStats.h"
#include "StringParser.h"
#include "ThreadContext.h"
#include <string>
using namespace std;
class HeadsTailsServer {
private:
char buffer[1024] = {0};
int socket;
ServerStats serverStats;
char DISCONNECT_RPC[1024] = "rpc=disconnect;";
char EXIT_MENU[1024] = "exitmenu";
// char CONFIRMATION[1024] = "rpc=confirmed;";
char RPC_1[1024] = "rpc1";
char RPC_2[1024] = "rpc2";
StringParser interpreter;
public:
explicit HeadsTailsServer(int socket, ServerStats &serverStats);
HeadsTailsServer();
~HeadsTailsServer();
string flipCoin();
void updateScoreboard(string, string, ThreadContext &context);
void getUserGuess();
int gameMenu(ThreadContext &context);
// Sends a message to client, and then closes the socket assigned to current client.
// return 0 if successful, -1 if failed
int disconnectGame2(int socket, char *buff);
};
#endif