-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnection.h
More file actions
18 lines (16 loc) · 838 Bytes
/
Connection.h
File metadata and controls
18 lines (16 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "includes.h"
#include "Thread.h"
#include "TCPSocket.h"
// A class representing a single connection form a client
class Connection : public Thread //Inherit from Thread
{
private:
TCPSocket * tcpSocket; // TCP Socket for communication with client
Connection * next_connection; // A way to build a linked list of connections for the garbage collector to be able to track them
public:
Connection(TCPSocket * p_tcpSocket); // Constructor: Set client connected TCP socket
void * threadMainBody (void * arg); // Main thread body that serves the connection
void setNextConnection(Connection * connection); // Set the next pointer: used by the Garbage Collector
Connection * getNextConnection (); // Get a pointer to the next connection
~Connection(); // Destructor
};