×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Apr 2005
    Posts
    75

    Bluetooth client and server

    Hi,
    although I fear I know the answer I have to ask the question:
    Is it possible to scan continuously (in a loop) for new Bluetooth-devices (client) while waiting for incoming connections (server) simultaneously on the same device?

    Is there any way to do this?


    Thanks,

    Kurt

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    47

    Re: Bluetooth client and server

    Hi Kurt,
    You didn't mention that if this server is a PC or a mobile acting as a bluetooth server.
    However, what you asked conceptually can be done on both sides. The implementation will certainly vary. At least you have to determine how many maximum connections will you allow to make if you are doing it in mobile. Because mobiles usually does not generally accept more than one incoming connection and even if they access it will be certainly very limited.
    And about the concept of doing a device scan and waiting for an incoming connection for the already detected devices,-
    while you are searching for devices, I hope you are doing this in a separate thread, for the already discovered devices fork a new thread to listen to an incoming connection from their end.

    Hope this helps..
    Regards,
    S.D.

  3. #3
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: Bluetooth client and server

    Hello Kurt,

    one thing to add to suvro's points (regarding looping device search): you didn't define whether you're about to use S60 or Series 40, but for S60 3rd Edition there may appear problems if you're calling new device search within inquiryCompleted() method (which is called when a device discovery cycle finishes). Usually this means that the application doesn't notify about the discovered devices as one would expect.

    For S60 3rd Edition, one should wait that inquiryCompleted() method returns before starting new device search.

    Regards,
    r2j7
    Last edited by r2j7; 2007-11-14 at 15:58.

  4. #4
    Regular Contributor
    Join Date
    Apr 2005
    Posts
    75

    Re: Bluetooth client and server

    I'm using the Nokia 6630 phone, so S60 2nd Edition, FP 2.

    I though this would be a problem because of the content of this thread:
    http://discussion.forum.nokia.com/fo...simultaneously

    Kurt

  5. #5
    Regular Contributor
    Join Date
    May 2006
    Location
    Milan, Italy
    Posts
    92

    Re: Bluetooth client and server

    Client and server can't work simultanousely, but is possible to implement an approach like this (I used it in one real project 1 year ago with jsr82) :

    all the devices start as a server and then when 1 device need to send messages switch to client, start a discovery(the first time) or send a message and then return as a server.
    In this approach is needed a good object oriented design, in fact, for preserve devices info, I used a main container for save the discovered devices finded by client or server module.
    If I remeber rigth the only problem is that when you need to end server you need to kill the thread because streamConnectionNotifier.acceptAndOpen() block the thread.

  6. #6
    Regular Contributor
    Join Date
    Apr 2005
    Posts
    75

    Re: Bluetooth client and server

    Hi,

    I have implemented a BT-client and BT-server thread. The client thread continuously scans for new BT-devices. If a new device is found a connection is established and data is transferred. The BT-server thread waits for incoming connections and sends data to connected devices.
    If I execute on one phone the BT-client and on two other phones a BT-server (or vice versa) the connection and the transfer of data works fine.
    But when I execute BT-client AND BT-server on each phone then I recognize some strange behavior:
    First, it takes a long time (~2-4 min) since one phone connect to another phone for transferring data. Second, although all phones are detected (inquiry) by each phone, a connection is only established with only a few of them. So instead of that one phone connects to the remainder phones it just connects to one phone. Third, the phones act differently. For instance after 5 minutes, the first phone did 20 inquiries, the second one 15 and the third one stopped after 1 inquiry.
    Everything happens without any error message.

    Does someone know why these phones act like this?

    Thanks,

    Kurt

  7. #7
    Regular Contributor
    Join Date
    Apr 2005
    Posts
    75

    Re: Bluetooth client and server

    No one has an idea?
    Has anyone set up something similar?

    Kurt

Similar Threads

  1. j2se server j2me client bluetooth connection problem
    By bepolat in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2010-07-14, 11:05
  2. Replies: 3
    Last Post: 2008-09-09, 04:53
  3. Question about bluetooth application (one client and server in the same device)
    By gonzi in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2008-07-24, 12:01
  4. J2ME client to C# server over Bluetooth?
    By Global_Inferno in forum Mobile Java Networking & Messaging & Security
    Replies: 17
    Last Post: 2007-03-26, 12:34
  5. Bluetooth client problem on games!
    By wmchan78 in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2006-03-22, 06:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×