Closed x3388638 closed 3 years ago
I find a dirty solution but I don't know why.
send data this way (300000
is just a number I set)
const stream = new Readable();
for (let i = 0; i < Math.ceil(dataBuffer.byteLength / 300000); i ++) {
stream.push(dataBuffer.slice(i * 300000, i * 300000 + 300000));
}
stream.push(null);
stream.pipe(socket);
proper soluditon would be to start using react-native-tcp-socket
instead of abandoned in 2017 package
On Android device I can't send data larger than a fixed size, and the fixed size for each Android device is different.
The case is that I try to send a base64 string of a photo on an ASUS Zenfone 2 (ASUS_Z00AD) with Android 5.0, and the total size of data is 1489556 byte, but it sends only 655350 byte. For Samsung GALAXY Tab S (SM-T700) with Android 5.0.2, it always sends 1015808 byte if the data is larger than that. For Sony Xperia ZR (C5502) with Android 5.0.2, the fixed size is 507904 byte. However, it seems that there isn't a such limitation on iOS device (iPhone 6 Plus with iOS 11.3.1).
Is there any configuration limits the max size of data to send or any solution? Thanks!
The way to send and receive data: