X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fsocket_client.hxx;h=eaad92f1d9206448dc190a3db7be97efb3301d28;hp=7160e0dd1b180295e56dde8f1b46777d5313af9f;hb=56f3994d74dbc36d10bfa83b50b016bf269ac563;hpb=b604df5f671b5e7abfd37570d76927a6ebd45f98 diff --git a/src/socket_client.hxx b/src/socket_client.hxx index 7160e0d..eaad92f 100644 --- a/src/socket_client.hxx +++ b/src/socket_client.hxx @@ -51,16 +51,24 @@ 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) { return client_connection::get_logstream(level); } public: socket_client_connection(int _port, const std::string& _server="127.0.0.1", long long _connect_timeout_usec=connect_timeout_usec_default, - int _max_retries=max_retries_default); + int _max_retries=max_retries_default, + std::ostream *_logstream=NULL, log_level_values _log_level=none); socket_client_connection(const std::string& _path, long long _connect_timeout_usec=connect_timeout_usec_default, - int _max_retries=max_retries_default); + 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. @@ -74,7 +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; } }; }