lemunozm / message-io

Fast and easy-to-use event-driven network library.
Apache License 2.0
1.11k stars 74 forks source link

client don't try reconnect #169

Open 2547409617 opened 7 months ago

2547409617 commented 7 months ago

hi, I run ping pong example, first run server and then run client, all is ok. I kill server, and run server again, client don't try reconnect. I hope client will try reconnect if network is disconnect.

hschneider commented 7 months ago

Remove reconnect=5 from the example.

lemunozm commented 7 months ago

Hi, I guess you're using Tcp or FramedTcp right? The way it works is how TCP works.

TCP does know about reconnections. Once the channel is closed by one side (i.e, when you kill the server), the connection is considered closed for the other endpoint. If you want a reconnection mechanism, you should implement this on top of Tcp by yourself. i.e, trying to connect again after some incremental period or similar.