How to stabilize Bluetooth Connection

leybra

New member
Joined
Sep 5, 2007
Messages
3
Programming Experience
1-3
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:

Code:
        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:

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,377
Location
Norway
Programming Experience
10+
Have you verified the port configuration with the documentation for your device? These settings all need to be correct. You should be able to find the same information from control panel, system, hardware, device manager, and navigating to the port there to look at its properties, but there is the possibility for the OS to be misconfigured also.
 

neel

New member
Joined
Jan 26, 2015
Messages
1
Programming Experience
5-10
Hi leybra,

I think the problem is you are sending 8+1+1 bits instead of 8+1 bits, which is usually with bluetooth over serial com.

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:

Code:
        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
 
Top Bottom