Monitoring  3.3.4
O2 Monitoring library
TCP.h
Go to the documentation of this file.
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
15 
16 #ifndef ALICEO2_MONITORING_TRANSPORTS_TCP_H
17 #define ALICEO2_MONITORING_TRANSPORTS_TCP_H
18 
19 #include "TransportInterface.h"
20 
21 #include <boost/array.hpp>
22 #include <boost/asio.hpp>
23 #include <boost/algorithm/string.hpp>
24 #include <chrono>
25 #include <string>
26 
27 namespace o2
28 {
30 namespace monitoring
31 {
33 namespace transports
34 {
35 
37 class TCP : public TransportInterface
38 {
39  public:
43  TCP(const std::string& hostname, int port);
44 
46  ~TCP() = default;
47 
50  void send(std::string&& message) override;
51 
52  private:
54  boost::asio::io_service mIoService;
55 
57  boost::asio::ip::tcp::socket mSocket;
58 
60  boost::asio::ip::tcp::resolver::iterator mEndpoint;
61 };
62 
63 } // namespace transports
64 } // namespace monitoring
65 } // namespace o2
66 
67 #endif // ALICEO2_MONITORING_TRANSPORTS_TCP_H
Definition: Backend.h:23
Transport that sends string formatted metrics via TCP.
Definition: TCP.h:37
void send(std::string &&message) override
Definition: TCP.cxx:48
Transport interface for backends.
Definition: TransportInterface.h:31
TCP(const std::string &hostname, int port)
Definition: TCP.cxx:31
~TCP()=default
Default destructor.