The Android Socket ReadLine () method does not read the value of the problem

Source: Internet
Author: User

In a single socket encoding, I send a data from the client to the server,


But in the server I use ReadLine () method did not take the value, also did not error.


So I wrapped the code that might have been wrong with the output statement and stopped compiling when I readline this line,


I realized there was something wrong with the reading.


The ReadLine method of BufferedReader is to read one line at a time, this method is blocked,


The program will continue to execute until it reads a line of data.


It is not until the program encounters a newline character or the Terminator ReadLine method of the corresponding stream that it is considered to have read a line.


To end its blocking and let the program continue down


So at the time of writing the string ends with a newline character on the line bw.write ("Hello server \ n");

The Android Socket ReadLine () method does not read the value of the problem

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.