Vpp Man
Vpp Man

Reputation: 2546

J2ME - Bluetooth serial port communication between PC and Mobile

I am trying to create a client server application. I am going to make this simple so that a basic chat application.

I have gone through these tutorials:

Server side: VB.Net
Client Side: J2ME

Working of my applications: both mobile and PC app will listen for messages (text). When a message is received from mobile to my PC, it will be displayed. Like that the opposite also.

In my computer I have Nokia PC Suite installed. I have both N70 and 5230 models. So, when I turn on my 5230's Bluetooth, my PC automatically connects (Nokia PC Suite shows a popup saying my mobile is connected). I have a Bluetooth dongle for my PC.

When I connected my mobile and checked the ports, I found that COM7 and COM8 are available (COM7 to COM10 are for Bluetooth serial communication). So, if I use one of those ports for my usage, will it get conflicted with Nokia PC suite's?

I mean, does PC suite also use the same ports(7 & 8) for communication to mobile? Any problems I mean loss of my contacts and messages, if I am using the same port that of Nokia PC suite is using?

Upvotes: 0

Views: 2323

Answers (1)

alanjmcf
alanjmcf

Reputation: 3440

I recommend not using virtual COM ports unless really necessary and instead using a Bluetooth API. My library 32feet.NET provides such an API, and thus one can use server code like the following. So much more robust that trying to set-up and use COM ports in my opinion... We even provide a Chat program in the samples.

Class MyConsts
  Shared ReadOnly MyServiceUuid As Guid _
    = New Guid("{00112233-4455-6677-8899-aabbccddeeff}")
End Class

  ...
  Dim serviceClass As Guid
  serviceClass = BluetoothService.SerialPort
  ' - or - etc
  ' serviceClass = MyConsts.MyServiceUuid
  '
  Dim lsnr As New BluetoothListener(serviceClass)
  lsnr.Start()


  ' Now accept new connections, perhaps using the thread pool to handle each
  Dim conn As New BluetoothClient = lsnr.AcceptBluetoothClient()
  Dim peerStream As Stream = conn.GetStream()
  ...

  ' etc
  conn As New BluetoothClient = lsnr.AcceptBluetoothClient()
  peerStream As Stream = conn.GetStream()
  ...

Upvotes: 1

Related Questions