otsdaq  v1_01_04
 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, bool verbose=true);
20  int send(Socket& toSocket, const std::vector<uint32_t>& buffer, bool verbose=true);
21  int send(Socket& toSocket, const std::vector<uint16_t>& buffer, bool verbose=true);
22 
23 protected:
24  TransmitterSocket(void);
25 
26 private:
27  std::mutex sendMutex_; //to make transmitter socket thread safe
28  // i.e. multiple threads can share a socket and call send()
29 
30 };
31 
32 }
33 
34 #endif