Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

网络tcp 在接收服务器消息后服务器立刻断开会导致以接收得消息不会派发到逻辑层 #61

Open
yangqingming opened this issue Feb 8, 2022 · 1 comment

Comments

@yangqingming
Copy link

网络tcp 在接收服务器消息后服务器立刻断开会导致以接收得消息不会派发到逻辑层

@SunHowe
Copy link

SunHowe commented Dec 9, 2022

个人认为服务器断开时,清除未处理的消息包是合理的行为,无非总结为两种情况:

  1. 异常断开:
    这种情况需要发起断线重连请求,在重连上后向服务端请求或服务端主动推送上线数据,断开之前的消息包未收到也不会产生影响
  2. 服务端主动踢出客户端:
    这种情况应考虑采用类似rpc的方式,服务端向客户端发送踢出通知,客户端向服务端返回业务层面的应答包以代表确认收到,然后服务端再关闭socket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants