-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTCPServerSocket.h
More file actions
26 lines (22 loc) · 995 Bytes
/
TCPServerSocket.h
File metadata and controls
26 lines (22 loc) · 995 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
#ifndef TCPSERVERSOCKET_H
#define TCPSERVERSOCKET_H
#include "includes.h"
#include "TCPSocket.h"
class TCPServerSocket // TCP Server Socket
{
private:
int sock; // Socket Handler
struct sockaddr_in serverAddr; // Server Socket Address Structure
struct sockaddr_in clientAddr; // Client Socket Address Structure
char * address; // Local address for the server socket to bind to
int port; // Local port for the server socket to bind to
int backlog; // Maximum length of the queue fo pending connections.
public:
// Constructor
TCPServerSocket (const char * _address, int _port, int _backlog );
bool initializeSocket (); // Initailize server socket
// Wait for a client connection and return a TCPSocket object that represents the client
TCPSocket * getConnection (int timeoutSec=0, int timeoutMilli=0,int readBufferSize=10*1024*1024,int writeBufferSize=10*1024*1024);
~TCPServerSocket ( ); // Destructor
};
#endif // TCPSERVERSOCKET_H