/** @file * @brief TCPService class header. This class represents a TCP client. * * * * @copyright Intra2net AG * @license GPLv2 */ #ifndef TCPSERVICE_H #define TCPSERVICE_H #include "logger.hpp" #include "ip_service.hpp" #include #include #include typedef boost::asio::ssl::stream SSLStream; class TCPService : public IPService { private: boost::shared_ptr Socket; // IOService has to be a member, otherwise the socket.close() operation will throw "mutex: Invalid argument" // Bug in boost::asio ? Cause no docs found concerning this issue. The socket.close() operation is trying to clean up io_service. boost::asio::io_service IOService; public: //typedef boost::shared_ptr Ptr; TCPService(); ~TCPService(); virtual void connect(const std::string& _hostname, const std::string& _port); std::string read_from_socket(); void write_to_socket(const std::string& data); void close(); }; #endif