summaryrefslogtreecommitdiff
path: root/src/3rd_party-static/message_broker/include/mb_tcpclient.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rd_party-static/message_broker/include/mb_tcpclient.hpp')
-rw-r--r--src/3rd_party-static/message_broker/include/mb_tcpclient.hpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/3rd_party-static/message_broker/include/mb_tcpclient.hpp b/src/3rd_party-static/message_broker/include/mb_tcpclient.hpp
new file mode 100644
index 0000000000..07697dbde7
--- /dev/null
+++ b/src/3rd_party-static/message_broker/include/mb_tcpclient.hpp
@@ -0,0 +1,58 @@
+/**
+ * \file mb_tcpclient.hpp
+ * \brief MessageBroker TCP client.
+ * \author AKara
+ */
+
+#ifndef MB_TCPCLIENT_H
+#define MB_TCPCLIENT_H
+
+#include <iostream>
+
+#include "mb_client.hpp"
+
+/**
+ * \namespace NsMessageBroker
+ * \brief MessageBroker related functions.
+ */
+namespace NsMessageBroker
+{
+
+ /**
+ * \class TcpClient
+ * \brief MessageBroker TCP client.
+ */
+ class TcpClient : public Client
+ {
+ public:
+ /**
+ * \brief Constructor.
+ * \param address remote network address or FQDN
+ * \param port remote local port
+ */
+ TcpClient(const std::string& address, uint16_t port);
+
+ /**
+ * \brief Destructor.
+ */
+ virtual ~TcpClient();
+
+ /**
+ * \brief Receive data from the network.
+ * \param data if data is received it will put in this reference
+ * \return number of bytes received or -1 if error
+ * \note This method will blocked until data comes.
+ */
+ virtual ssize_t Recv(std::string& data);
+
+ /**
+ * \brief Send data.
+ * \param data data to send
+ * \return number of bytes sent or -1 if error
+ */
+ ssize_t Send(const std::string& data);
+ };
+
+} /* namespace NsMessageBroker */
+
+#endif /* MB_TCPCLIENT_H */