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

用第三方socket工具为什么收不到数据? #174

Open
haodynasty opened this issue Jul 6, 2020 · 4 comments
Open

用第三方socket工具为什么收不到数据? #174

haodynasty opened this issue Jul 6, 2020 · 4 comments

Comments

@silentzone
Copy link

同样的问题,坐等

@paleomoon
Copy link

+1,第三方socket工具作为服务端能收到数据,将收到的数据(字节数组)再发给客户端,客户端收不到,onSocketReadResponse不执行。协议没修改,使用的是默认的(4字节header+body)。

比如发送{“cmd”:0},对应字节数组[00 00 00 09 7B 22 63 6D 64 22 3A 30 7D],socket工具收到后,回复同样的字节数组给客户端(所以协议应该是没问题的),客户端收不到。但使用demo作为服务端能正常收发。

这个问题挺多人遇到了,为什么这么久了还没有答案?

@xuuhaoo
Copy link
Owner

xuuhaoo commented Nov 17, 2020

首先您需要符合通讯协议才能收到消息, 通讯协议在WIKI中已经写出,您可以自定义协议,但是您发送的数据需要符合您定义的协议.
默认协议是4个字节包头+包体.包头4字节为一个Int标识包体长度

@dylanZk1
Copy link

dylanZk1 commented Feb 7, 2024

那如果收发的协议不是一套的呢

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

5 participants