multithreaded obex server

  • thomasx

    thomasx - 2007-11-01

    hi all,

    due to the OpenOBEX shared library programming guide on it is possible to write an obex server which accepts multiple connections, not only one. It uses OBEX_Accept during the OBEX_EV_ACCEPTHINT event, then retrieves a new OBEX handle while the old handle still listens for incomming connections. Due to the OBEX headers (obex.h, obex_const.h) there is no OBEX_Accept() defined, only OBEX_ServerAccept() and that one returns an OBEX handle. Has anyone gathered some experience in that direction or knows a good URL where to learn from some examples? Or should the issue be solved like the POSIX sockets are also used for incoming multiple connections?
    Every OBEX server sample which I have found is unfortunatelly written to only serve one client at the time. Any help is appreciated.

    • cvv_

      cvv_ - 2007-11-01

      multithreaded and multiclient server isn't same.

      threads is for people who cant program finite state machine

    • thomasx

      thomasx - 2007-11-01


      yes, i know, it was to late after the messsage has been posted. but nevertheless my posting made it clear what the issue is about. i made now already some progress and it works to a specific point. however if soembody has a knowledge of a good URL or book or whatever could help in this direction, it would be great.

      threads is for people who cant program finite state machine
      >hmm, why is it always needed to give such comments. they don't help in any way.


    • angel i

      angel i - 2008-08-04

      I am also looking for a solution to an multhithreaded obex server, did you made any progress with your code?

      • Christian W. Zuckschwerdt

        It's important to note that usually BT dongles will only multiplex a very small number of connections. Preferably you'd test with a multi HCI setup.

    • Pavel R

      Pavel R - 2008-09-20


      I'm dealing with a similar problem. I need to write a BT server application, which is going to listen to incoming connections from Mobile phones and will send and receive files to/from those phones. I used an example code here to send a file to a phone, but i couldn't  create a listening server which will listen to incoming connections and receives a file.
      I need to understand how to use the obex.c functions to create such an application.
      I'd like it to be a multi-threaded program: a main thread will listen to a incoming connections and a secondary thread will deal with each connection request.

      Could you please tell me the flow of such a program?


      • Christian W. Zuckschwerdt

        As already discussed, don't use threading. Use an event loop.

    • Pavel R

      Pavel R - 2008-09-20

      Thank you so much for the quick response!

      Could you please elaborate a bit on this?

      How to implement an event loop using the obex.c functions?
      I mean which functions to use and in which order? I need to understand first the general flow on such an application - How to create a listening server with an event loop.

      Thank you very much for you time!

      • Christian W. Zuckschwerdt

        Basicly you only need to call HandleInput for every active connection in turn. Listening and outbound socket creation is like in the simple synchronous examples.
        Other people are working on similar things and there will be more general functions to do this soon. What is your timeframe?

    • Pavel R

      Pavel R - 2008-09-20

      This is an academic project and I'm already past my deadline : (
      However  i have a 2 weeks extension...

    • Rizwan Basha

      Rizwan Basha - 2009-01-22


      iam dealing with a problem of file transfer to all nearby visible devices.

      I am done with file transfer to all nearby visible devices but one after the other,and request for file transfer comes to one device at a time.

      "How can get multi connections before you start sending the data to devices...
      then  fashion roundrobin over each connection to send chunks of data "

      so that file transfer is done to all at same time..

      plz help any

    • Rizwan Basha

      Rizwan Basha - 2009-02-05

      Hai Christian,

      I need that Program used to transfer files to all visible devices at a time using event looping.

      Can you post that example to transfer files to all visible devices with event looping .  Though i have used threads alot,I cant get it working) .

      Iam eager to have that listening server with event looping.Please help me.Post it ar give any links for such type of application.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks