libt2n: (tomj) fixed call of virtual function close() from destructor, fixed return...
[libt2n] / src / socket_client.hxx
index c103cbb..eaad92f 100644 (file)
@@ -51,6 +51,8 @@ class socket_client_connection : public client_connection, public socket_handler
         std::string server;
         int port;
 
+        std::string lastErrorMsg;
+
     protected:
 
         std::ostream* get_logstream(log_level_values level)
@@ -66,6 +68,8 @@ class socket_client_connection : public client_connection, public socket_handler
             int _max_retries=max_retries_default,
             std::ostream *_logstream=NULL, log_level_values _log_level=none);
 
+        ~socket_client_connection();
+
         /** @brief read data from the socket and copy it into buffer
             @param usec_timeout wait until new data is found, max timeout usecs.
                   -1: wait endless
@@ -78,9 +82,12 @@ class socket_client_connection : public client_connection, public socket_handler
         bool fill_buffer(long long usec_timeout=-1, long long *usec_timeout_remaining=NULL)
             { return socket_handler::fill_buffer(buffer,usec_timeout,usec_timeout_remaining); }
 
-        void close();
+        virtual void close();
 
         void reconnect();
+
+        std::string get_last_error_msg(void)
+            { return lastErrorMsg; }
 };
 
 }