Hi guys, I need some help about how to stabilize bluetooth connection using vb.net 2005? Currently, I am using Serialport to establish a connection, but some times it failed to connect with this error message "The port 'COM6:' does not exist". Usually, 4 out of 10 attempts will bring out this error message. Maybe, my coding is not good enough, so hopefully someone can guide me with this. Thanks.
This is sample of my coding:
This is sample of my coding:
VB.NET:
serialPort.PortName = "COM6"
serialPort.BaudRate = 115200
serialPort.Parity = IO.Ports.Parity.None
serialPort.DataBits = 8
serialPort.StopBits = IO.Ports.StopBits.Two
Try
serialPort.Open()
serialPort.ReadTimeout = 50000
serialPort.WriteTimeout = 50000
If serialPort.IsOpen Then
MsgBox("Connection successful")
End If
serialPort.Close()
Catch ex As Exception
MsgBox(ex.Message)
serialPort.Close()
End Try
Last edited by a moderator: