blob: decf4243518353d17e6996a3baa3df6eeb0ca8d2 (
plain) (
blame)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Connection.h
// Interfaces to the cConnection class representing a single pair of connected sockets
#pragma once
#include <time.h>
class cServer;
class cConnection
{
cCriticalSection m_CSLog;
FILE * m_LogFile;
cServer & m_Server;
SOCKET m_ClientSocket;
SOCKET m_ServerSocket;
clock_t m_BeginTick; // Tick when the relative time was first retrieved (used for GetRelativeTime())
public:
cConnection(SOCKET a_ClientSocket, cServer & a_Server);
~cConnection();
void Run(void);
void Log(const char * a_Format, ...);
void DataLog(const void * a_Data, int a_Size, const char * a_Format, ...);
protected:
bool ConnectToServer(void);
/// Relays data from server to client; returns false if connection aborted
bool RelayFromServer(void);
/// Relays data from client to server; returns false if connection aborted
bool RelayFromClient(void);
/// Returns the time relative to the first call of this function, in the fractional seconds elapsed
double GetRelativeTime(void);
} ;
|