bluetooth chat desktop problem

Topics: Samples
Nov 13, 2012 at 6:07 AM

hi

i want your help about this

i have application vb.net that communicate with android phone

when i send message from phone to vb.net

it receive one-time only  except once i reconnect to it and send again

 

i thought problem is in here

'form load

listening = True

Dim t1 As System.Threading.Thread
t1 = New Threading.Thread(AddressOf receiveLoop)
t1.Start()
btClient = New BluetoothClient
Dim bdi As BluetoothDeviceInfo() = btClient.DiscoverDevices()
cboDevices.DataSource = bdi
cboDevices.DisplayMember = "DeviceName"



Public Sub receiveLoop()
Dim strReceived As String
btListener = New BluetoothListener(ServiceName)
btListener.Start()

strReceived = receiveMessage(MAX_MESSAGE_SIZE)
While listening '---keep on listening for new message
If strReceived <> "" Then
Me.Invoke(New EventHandler(AddressOf UpdateTextBox))

strReceived = receiveMessage(MAX_MESSAGE_SIZE)
End If
End While

End Sub

Developer
Nov 13, 2012 at 9:00 AM

The old BluetoothChat sample sends one message and then closes the connection. Have a look at the new BluetoothChat2 sample.

From the Readme:

  • Retired: BluetoothChat2 - Replaced by BluetoothChat2 — it doesn’t hang at start-up doing a discovery, and uses one connection between the pair of chat users to transfer the messages back and forth. Note: is not useful for testing general connections, use BluetoothSDP instead.

The BluetoothChat2 send/receives each messages on a newline (CR+LF as newline).

Nov 13, 2012 at 6:55 PM

thank you very much
i want to use old version because i can't understand c#
where can i edit the code is it what i posted upper ?
would you tell how can i edit to receive without close the connection

best regards

Nov 14, 2012 at 6:43 PM

thank you very much

i am using  serial port now

i think that's better way

good luck

Developer
Nov 16, 2012 at 10:32 AM

I've created a VB version of the Chat2 sample. Find it in the code respository here.

Nov 19, 2012 at 8:03 PM

Hi,

 

             I do not see the link to your new exmaple. Can you please post it? Thanks.

Developer
Nov 26, 2012 at 9:04 PM

Go to http://32feet.codeplex.com/SourceControl/BrowseLatest and click Download you will find it in the Sample folder in the ZIP file. :-)