Issue
I set up a bluetooth connection between Raspberry and a computer. I wish to carry out a pilot icon which would allow me to check if connection is always present. For that I carried out a Thread. For the test, I sending a message on the link of the PC towards RPi, if the Rpi receive something , she reference me a message and if I receive it on my computer is that the connection is always present. The probelm is that I have an error at the time of the reception side PC.
Here the detail: The operation of E/S was abort because of the stop of a thread or the request of an application.
Here two codes for the connection series:
Pc side with VB :
Private Sub checkBT()
Dim buffer As String = ""
While True
BluetoothPort.Write("Test")
buffer = BluetoothPort.ReadLine()
While buffer = ""
buffer = BluetoothPort.ReadLine()
End While
WriteInLog("" & buffer)
checkBT_thread.Sleep(20000)
End While
End Sub
Rpi side with Python:
import serial
serial_com = serial.Serial("/dev/rfcomm0", baudrate = 115200, timeout = 0, writeTimeout = 5)
print "INIT Bluetooth connection"
while 1:
x = serial_com.readline()
if x == "Test":
print x
serial_com.write("Recu")
Do you have an idea about the problem please? Can the error come owing to the fact that I use of Windows forms?
Solution
I solved my problem with the serialPort.ReadExisting() method.
Answered By - T.Justice