Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Buddy's,
I am trying to collect stream of bytes from a Blue tooth in WPF program. I am calling the ReadBTSignal function from a thread. Thread will execute for every 1 msec.
The below program works fine in winform. It is getting the stream and I didn't have any issues. But in WPF it is hung in the below line
sr.ReadByte().
It didn't get any error message and it didn't go to the next line. It is hung in that line.
I tried to execute in the try catch block but it didn't come to the catch block. I have attached the code snippet for your reference and I am using the below namespaces.

using InTheHand.Net;
using InTheHand.Net.Sockets;
using InTheHand.Net.Bluetooth;

public void ReadBTSingle(int AmountData, out int intGetDataLose, out int[] rawdata, out bool[] ChannelEnable)
{
private Stream sr;
int[] intArrayHeader = new int[2];
for (int x = 0; x < 2; x++)
{
intArrayHeader[x] = sr.ReadByte();
}

}
This is a show stopper issue and I desperately need some help on this. Please share your inputs.

Thanks
Posted
Comments
Fredrik Bornander 11-Jul-13 11:07am    
Are you sure there is something available on the sr stream? It sounds like you are doing a blocking read with no data being written.

Check tha you have data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900