otsdaq  v2_05_02_indev
TCPServer.h
1 #ifndef _ots_TCPServer_h_
2 #define _ots_TCPServer_h_
3 
4 #include <string>
5 #include "otsdaq/NetworkUtilities/TCPServerBase.h"
6 
7 namespace ots
8 {
9 class TCPTransceiverSocket;
10 
11 class TCPServer : public TCPServerBase
12 {
13  public:
14  TCPServer(int serverPort, unsigned int maxNumberOfClients = -1);
15  virtual ~TCPServer(void);
16 
17  virtual std::string interpretMessage(const std::string& buffer) = 0;
18  void setReceiveTimeout(unsigned int timeoutSeconds, unsigned int timeoutMicroseconds);
19  void setSendTimeout(unsigned int timeoutSeconds, unsigned int timeoutMicroseconds);
20 
21  private:
22  void acceptConnections(void) override;
23  void connectClient(TCPTransceiverSocket* clientSocket);
24  struct timeval fReceiveTimeout;
25  struct timeval fSendTimeout;
26 };
27 }
28 
29 #endif