[Update]Netty支持断线重连机制

This commit is contained in:
chenfufeng
2022-02-21 19:43:14 +08:00
parent 6e850b0cab
commit d3a2374270
8 changed files with 184 additions and 203 deletions

View File

@@ -130,14 +130,16 @@ public class NettyServerActivity extends AppCompatActivity implements View.OnCli
if (!NSDNettyManager.getInstance().isServerStart()) {
Toast.makeText(getApplicationContext(), "未连接,请先连接", LENGTH_SHORT).show();
} else {
NSDNettyManager.getInstance().sendMogoProtocolMsgToClient(mogoProtocolMsg, channelFuture -> {
if (channelFuture.isSuccess()) {
Log.d(TAG, "Write auth successful");
logSend(Arrays.toString(mogoProtocolMsg.getBody()));
} else {
Log.d(TAG, "Write auth error");
}
});
// NSDNettyManager.getInstance().sendMogoProtocolMsgToClient(mogoProtocolMsg, channelFuture -> {
// if (channelFuture.isSuccess()) {
// Log.d(TAG, "Write auth successful");
// logSend(Arrays.toString(mogoProtocolMsg.getBody()));
// } else {
// Log.d(TAG, "Write auth error");
// }
// });
NSDNettyManager.getInstance().sendMsgToAllClients(mogoProtocolMsg);
logSend(Arrays.toString(mogoProtocolMsg.getBody()));
mSendET.setText(Arrays.toString(mogoProtocolMsg.getBody()));
}
break;