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

当数据量大的时候会出现异常现象,主要是获取body的length #8

Open
FrankCYQ opened this issue Dec 15, 2017 · 9 comments

Comments

@FrankCYQ
Copy link

NSData *lengthData = [MessageDataPacketTool getsubdata:data withRange:NSMakeRange(0, 4)];

int length = 0;

[lengthData getBytes: &length length: sizeof(uint32_t)];
NTOHL(length);

IP_PACKET ipPacket;
ipPacket.length = length;

image

很明显这个length应该是错误的,也不清楚是什么原因

@FrankSwift
Copy link

I also have met the same problem,any solution?

@Fight0913
Copy link
Contributor

数据量有多大呢? 超出了服务端设置的4个字节的最大长度吗

@FrankCYQ
Copy link
Author

FrankCYQ commented Jan 29, 2018 via email

@Fight0913
Copy link
Contributor

Fight0913 commented Feb 2, 2018 via email

@GoKnow
Copy link

GoKnow commented Apr 24, 2018

最新的Demo也是会出现这个问题的,在socket接收方法里面定位到data偶然会出现data.length == 2的情况(data.length == 1代表心跳),另外一个问题是大量数据压测,可能会出现doule free的情况,但是如果将接受到的数据处理过程全部放在主线程中,就可以避免。

@Fight0913
Copy link
Contributor

Fight0913 commented Apr 25, 2018 via email

@GoKnow
Copy link

GoKnow commented Apr 27, 2018

数据解析不来,就是突然会出现data长度为2,这个时候直接导致崩溃,只能对这个进行特殊处理,把data.length==2的直接过滤,把他也当成心跳包这样子的无用数据。

@Fight0913
Copy link
Contributor

Fight0913 commented Apr 27, 2018 via email

@FrankSwift
Copy link

image

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

4 participants