We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
InputStream.available() 这个方法可以在读写操作前先得知数据流里有多少个字节可以读取, 使用时遇到一些麻烦,比如,通讯时,对方明明发来了1000个字节,但是自己的程序调用available()方法却只得到900,或者100,甚至是0, 这是因为串口通讯是间断性的,和波特率有关,一串字节往往分几批进行发送。本地程序调用available()方法有时得到0,这可能是对方还没有响应,也可能是对方已经响应了,但是数据还没有送达本地。对方发送了1000个字节给你,也许分成3批到达,这你就要调用3次available()方法才能将数据总数全部得到。
InputStream.available()
The text was updated successfully, but these errors were encountered:
为什么我第一次发送数据没有返回,要发2到3次才会有返回,而且返回的数据会重复一部分,求大佬帮忙呀
Sorry, something went wrong.
No branches or pull requests
InputStream.available()
这个方法可以在读写操作前先得知数据流里有多少个字节可以读取,使用时遇到一些麻烦,比如,通讯时,对方明明发来了1000个字节,但是自己的程序调用available()方法却只得到900,或者100,甚至是0, 这是因为串口通讯是间断性的,和波特率有关,一串字节往往分几批进行发送。本地程序调用available()方法有时得到0,这可能是对方还没有响应,也可能是对方已经响应了,但是数据还没有送达本地。对方发送了1000个字节给你,也许分成3批到达,这你就要调用3次available()方法才能将数据总数全部得到。
The text was updated successfully, but these errors were encountered: