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

关于rpc模块的粘包问题 #81

Open
SuycxZMZ opened this issue Aug 18, 2024 · 2 comments
Open

关于rpc模块的粘包问题 #81

SuycxZMZ opened this issue Aug 18, 2024 · 2 comments
Labels
working 进行中

Comments

@SuycxZMZ
Copy link

屏幕截图 2024-08-18 161757
retrieveAllAsString 每次把缓冲区内容全部拿出,如果极端情况下缓冲区只有1.5个rpc请求,那么这时,一定会粘包,下一个onMessage解析0.5个请求,上来就解析出错。这个写法是短连接的写法,最简单的修改方法是在每一个rpc包前面加一个长度,然后一个包一个包的读。在这个项目中之所以没出现粘包是因为调用者的一收一发(rpcChannel里)是连在一起的,发完等待收,从时间上来看是一个包一个包的发送,所以粘包不会发生。

Copy link

Message that will be displayed on users' first issue

@SuycxZMZ
Copy link
Author

这个我只是提一个意见,因为本问题不会导致本项目运行出错。我的fork改动太多了,pr不太好提,

@578223592 578223592 added the working 进行中 label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
working 进行中
Projects
None yet
Development

No branches or pull requests

2 participants