Android Development socket send will have some garbled, serial code, accompany with the data received incomplete

Source: Internet
Author: User

Scene:

Client A, B,a sends a JSON string to B and then sends the file, and B receives the file before returning the message.

Environment: Android, using the original write and read (if you are using WRITEUTF, this issue does not occur.) ) requires an iOS docking

Cause: Write data with the continuous write method will appear together with the case of read, the data cache string chaos

Workaround: The write must be read one time later, in order to guarantee that a will not read the second write at the time of the first reading.

Android Development socket send will have some garbled, serial code, accompany with the data received incomplete

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.