tdaq-develop-2025-02-12
UDPDataStreamerBase.h
1 #ifndef _ots_UDPDataStreamerBase_h_
2 #define _ots_UDPDataStreamerBase_h_
3 
4 #include <string>
5 #include "otsdaq/NetworkUtilities/ReceiverSocket.h" // Make sure this is always first because <sys/types.h> (defined in Socket.h) must be first
6 #include "otsdaq/NetworkUtilities/TransmitterSocket.h" // Make sure this is always first because <sys/types.h> (defined in Socket.h) must be first
7 
8 namespace ots
9 {
11 {
12  public:
13  UDPDataStreamerBase(std::string IPAddress,
14  unsigned int port,
15  std::string toIPAddress,
16  unsigned int toPort);
17  virtual ~UDPDataStreamerBase(void);
18 
19  int send(const std::string& buffer)
20  {
21  return TransmitterSocket::send(streamToSocket_, buffer);
22  }
23  int send(const std::vector<uint32_t>& buffer)
24  {
25  return TransmitterSocket::send(streamToSocket_, buffer);
26  }
27 
28  protected:
29  ReceiverSocket streamToSocket_;
30 };
31 
32 } // namespace ots
33 
34 #endif
UDPDataStreamerBase(std::string IPAddress, unsigned int port, std::string toIPAddress, unsigned int toPort)