otsdaq  v2_05_02_indev
TCPPublishServer.cc
1 #include "otsdaq/NetworkUtilities/TCPPublishServer.h"
2 #include "otsdaq/NetworkUtilities/TCPTransmitterSocket.h"
3 
4 #include <iostream>
5 
6 using namespace ots;
7 
8 //==============================================================================
9 TCPPublishServer::TCPPublishServer(int serverPort, unsigned int maxNumberOfClients) : TCPServerBase(serverPort, maxNumberOfClients) {}
10 
11 //==============================================================================
12 TCPPublishServer::~TCPPublishServer(void) {}
13 
14 //==============================================================================
15 void TCPPublishServer::acceptConnections()
16 {
17  while(true)
18  {
19  try
20  {
21  __attribute__((unused)) TCPTransmitterSocket* clientSocket = acceptClient<TCPTransmitterSocket>();
22  }
23  catch(int e)
24  {
25  std::cout << __PRETTY_FUNCTION__ << "SHUTTING DOWN SOCKET" << std::endl;
26  std::cout << __PRETTY_FUNCTION__ << "SHUTTING DOWN SOCKET" << std::endl;
27  std::cout << __PRETTY_FUNCTION__ << "SHUTTING DOWN SOCKET" << std::endl;
28 
29  if(e == E_SHUTDOWN)
30  break;
31  }
32  }
33  fAcceptPromise.set_value(true);
34 }