Lichtso / netLink

Socket and Networking Library using msgpack.org[C++11]
GNU General Public License v3.0
216 stars 48 forks source link

How to reconnect? #32

Closed dumbo1985 closed 4 years ago

dumbo1985 commented 4 years ago

Thank you for sharing this code!

I wrote a tcp client. When I closed tcp server, the client won't reconnect..

Please teach me how to reconnect the tcp server, Thank's a lot!

dumbo1985 commented 4 years ago

@Lichtso Thank you !

Lichtso commented 4 years ago

If you take a look at the TCP Example line 56 covers the connection loss case. Here you could trigger a retry and decrement a counter (as you probably only want 3 retries for example). The retry itself is identical to the first connection setup: socket->initAsTcpClient(...)