JSS
JSS

Reputation: 404

Best way to have Netty Client attempt recconnection if remote peer disconnects?

I've implemented Netty client code that connects to a server. If the server closes the connection viathe disconnect message, we want the client to continually try to reconnect?

Is this best way to handle TCP Disconnect through the channelInactive callback?

Also, channelInactive will not handle TCP timeout, correct?

Upvotes: 0

Views: 382

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23557

channelInactive or adding a ChannelFutureListener to Channel.closeFuture() is the right way to handle this. Just be aware you can not "reconnect" and existing Channel but need to bootstrap a new one.

Upvotes: 0

Related Questions