I am trying to transfer some data of data through RFCOMM using streams. I send data out, and it gets echoed back.
BluetoothClient bc = new BluetoothClient();
BluetoothDeviceInfo devices = bc.DiscoverDevices(1); //Discover a maximum of one device (saves waiting for whole inquiry period)
Guid service = InTheHand.Net.Bluetooth.BluetoothService.RFCommProtocol; //UUID 0x0003
InTheHand.Net.Bluetooth.ServiceRecord rec = devices.GetServiceRecords(service); //Just so I can see the service record
BluetoothWin32Authentication win = new BluetoothWin32Authentication(HandleAuth);
var peerStream = bc.GetStream();
var st = new StreamReader(peerStream);
var sw = new Stopwatch();
var buffer = new int;
var wr = new byte;
var rand = new Random();
for (int i = 0; i < 1000000; i++)
wr[i] = Convert.ToByte(rand.Next(128));
peerStream.Write(wr, 0, 1000000);
int streamPos = 0;
buffer[streamPos] = st.Read();
if (streamPos == 1000000)
The data will finish transferring (I can breakpoint on Console.WriteLine("Data transfer")), but when I continue to step through the code, it will return to the while(!st.EndOfStream), but if I try expanding the st stream and inspecting the member
variables values they simpread
"Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation.".
Attemping to continue stepping through results in the whole application just hanging. What is happening?
I've tried using smaller amount of data but it still never gets out of the while loop. What do people think?
Generic USB dongle
Connecting to a BT chip running an RFCOMM server on a DevBoard
P.S The speed of my connection is only 0.76 MBit/s (took 10.5 seconds to transfer 1Mbyte0, which is fairly shoddy, considering the application throughput listed by BT 2.1 EDR is . Do I need to configure something the chip to set it into a higher speed?