otsdaq  v1_01_03
 All Classes Namespaces Functions
TransmitterSocket.h
1 #ifndef _ots_TransmitterSocket_h_
2 #define _ots_TransmitterSocket_h_
3 
4 #include "otsdaq-core/NetworkUtilities/Socket.h"
5 
6 #include <string>
7 #include <vector>
8 #include <mutex> //for std::mutex
9 
10 namespace ots
11 {
12 
13 class TransmitterSocket : public virtual Socket
14 {
15 public:
16  TransmitterSocket(const std::string &IPAddress, unsigned int port=0);
17  virtual ~TransmitterSocket(void);
18 
19  int send(Socket& toSocket, const std::string& buffer);
20  int send(Socket& toSocket, const std::vector<uint32_t>& buffer);
21 
22 protected:
23  TransmitterSocket(void);
24 
25 private:
26  std::mutex sendMutex_; //to make transmitter socket thread safe
27  // i.e. multiple threads can share a socket and call send()
28 
29 };
30 
31 }
32 
33 #endif