-
Notifications
You must be signed in to change notification settings - Fork 151
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
WebSocket客户端连接服务端还没准备好,服务端就返回封包了.导致错过了第一条封包. #125
Comments
经过测试发现是服务端收到客户端Open事件中马上WsSend(’字符串数据‘)到客户端,客户端有时候接收不到,客户端处理握手包的时候忽略掉了后面粘着的’字符串数据‘。应该是粘包问题,请作者明察。 |
测试地址 ws://gf.mspoint.xyz:8810/api/user/ws?ExeID=123&DevID=456 |
这个比较麻烦,相当于是websocket的数据包和前面http的包粘在一起发出了,等我有时间想想怎么处理吧 |
可以参考 Bird.Socket.Client.pas |
推了个更新,麻烦帮忙测试下还有没有这个问题 |
目测没啥问题。感谢。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在WebSocket编程中,客户端与服务器之间的实时双向通信确实可能会遇到您描述的这种情况,即客户端连接到WebSocket服务器后,服务器立即发送数据,但客户端尚未准备好处理这些数据。为了应对这个问题,您可以采取以下一些策略:
缓冲接收的数据:在客户端,设置一个缓冲区(例如,使用队列),用于临时存储接收到的数据。这样,即使客户端尚未准备好立即处理这些数据,也可以确保数据不会丢失。然后,一旦客户端准备好处理这些数据,可以从缓冲区中读取并进行处理。
The text was updated successfully, but these errors were encountered: