Bug 28356 - Bluetooth reading inputstream stops before end of file
Summary: Bluetooth reading inputstream stops before end of file
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.20.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-03-24 04:51 UTC by j.van.vijfeijken
Modified: 2017-09-12 18:32 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Example projects (23 bytes, text/plain)
2015-03-24 04:55 UTC, j.van.vijfeijken
Details
Examples reuploaded (137 bytes, text/plain)
2015-04-14 05:18 UTC, j.van.vijfeijken
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description j.van.vijfeijken 2015-03-24 04:51:18 UTC
We've created an app, which is like a Bluetooth SPP terminal. You can send a command to a connected Bluetooth device and the apps adds incoming messages to a TextView.
Problem is that when reading the InputStream of the BluetoothSocket suddenly doesn't receive any data anymore, where the data set the device is sending isn't complete yet (our end-of-file line isn't received, it stops halfway).
We built the exact same app in Java using Android SDK, this app does reach the end of file line.

I’ve included two example projects in the attachment archive. One in c#/xamarin and one in java. The app in java works as expected, when I connect to a device and send a command, it keeps receiving data from the Bluetooth device, until I see the end of file line.
The Xamarin app is the same code, but converted to C#/Xamarin. After I send a command to the Bluetooth device ,I do receive data back from it, but it stops suddenly and I never receive data again.

Steps to reproduce:

The BluetoothDeviceName should be the name (devicename, not the mac address) of the device you’re going to connect with. It should’ve been paired via the Android settings menu before running the app. Since this is an testing app I didn’t want to deal with the device discovery process in the app.

We are connecting to a device, but the problem occurs using any Bluetooth device. As an example we tried connecting with a pc that sends back a large amount of data after receiving a command.

After the BluetoothDeviceName has been set, and the app is running on a device, you should be able to connect to the bluetooth device by clicking the ‘Connect’ button. When the connecting process has been successful the button text changes to ‘Disconnect’.

After that we send a command to the device by typing it in the top edittext, and clicking send button. The device will receive our command and start sending a large amount of data. The last line contains an end of file code.

The app will then start receiving data and show it in the textview. (this process may be a little bit slow, since it is a test app and we didn’t want to spend time on working out ui things properly, just tried getting the connection to work).
After it’s done we see it stopped before the end-of-file line, the last line it’s showing is not complete either.

The included Java app has the same code as the Xamarin app (we converted the Java app to Xamarin) but the Java app does receive the entire file, as we can see the end-of-file line.


Windows 8.1
Visual Studio Professional 2012 update 4
Xamarin 3.9.302.0
Xamarin.Android 4.20.0.34

Tested on Android devices running Android 5.0 and 4.4
Comment 1 j.van.vijfeijken 2015-03-24 04:55:43 UTC
Created attachment 10467 [details]
Example projects
Comment 2 Jonathan Pryor 2015-04-13 16:35:50 UTC
Unfortunately, the provided URL is no longer valid. :-(

Could you please make it available again?
Comment 3 j.van.vijfeijken 2015-04-14 05:18:24 UTC
Created attachment 10747 [details]
Examples reuploaded

Reuploaded
Comment 4 Jon Douglas [MSFT] 2017-09-12 18:32:37 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.