X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fsocket_client.cpp;fp=src%2Fsocket_client.cpp;h=4f4975f29fc832864e99a75b44ffbedf738cb37a;hp=8b70511145e8d692554abc4cd199ce7120588ebc;hb=af84dfb53a739a0c8c343d9172f1847fa908906d;hpb=a64066eb0e456c92c4c06959616443e531d4b39d diff --git a/src/socket_client.cpp b/src/socket_client.cpp index 8b70511..4f4975f 100644 --- a/src/socket_client.cpp +++ b/src/socket_client.cpp @@ -185,4 +185,21 @@ void socket_client_connection::close() } } +/** @brief try to reconnect the current connection with the same connection credentials (host and port or path) +*/ +void socket_client_connection::reconnect() +{ + // close the current connection if still open + close(); + + socket_type_value type=get_type(); + + if (type == tcp_s) + tcp_connect(max_retries); + else if (type == unix_s) + unix_connect(max_retries); + + reopen(); +} + }