All of lore.kernel.org
 help / color / mirror / Atom feed
* Multiple client connections?
@ 2015-10-13 23:45 Mark Spruiell
  2015-10-14 12:38 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Spruiell @ 2015-10-13 23:45 UTC (permalink / raw)
  To: linux-bluetooth

We'd like to be able to establish multiple simultaneous client
connections to the same service, both from a single process and from
multiple processes. (Essentially, we'd like to create bluetooth socket
connections just like we can for regular TCP socket connections, for
example.)

My client does the following:

* Gets a private connection to the system bus
* Calls GetManagedObjects to locate the device corresponding to the
target address
* Calls RegisterProfile with a unique object path and the target UUID
* Calls ConnectProfile on the target device with the target UUID
* Receives a NewConnection call with the file descriptor
* Uses the file descriptor like a regular socket
* When finished, calls DisconnectProfile, waits for it to complete,
and closes the socket

This works correctly. However, when I try to start another instance of
the client process and connect to the same service, this second
connection attempt fails. The first connection remains active and
continues to work. This second client would have registered its own
client profile with a unique object path and the same target UUID.

Is it possible for a single host to establish multiple connections to
the same service?

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Multiple client connections?
  2015-10-13 23:45 Multiple client connections? Mark Spruiell
@ 2015-10-14 12:38 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2015-10-14 12:38 UTC (permalink / raw)
  To: Mark Spruiell; +Cc: linux-bluetooth

Hi Mark,

On Wed, Oct 14, 2015 at 2:45 AM, Mark Spruiell <mes@zeroc.com> wrote:
> We'd like to be able to establish multiple simultaneous client
> connections to the same service, both from a single process and from
> multiple processes. (Essentially, we'd like to create bluetooth socket
> connections just like we can for regular TCP socket connections, for
> example.)
>
> My client does the following:
>
> * Gets a private connection to the system bus
> * Calls GetManagedObjects to locate the device corresponding to the
> target address
> * Calls RegisterProfile with a unique object path and the target UUID
> * Calls ConnectProfile on the target device with the target UUID
> * Receives a NewConnection call with the file descriptor
> * Uses the file descriptor like a regular socket
> * When finished, calls DisconnectProfile, waits for it to complete,
> and closes the socket
>
> This works correctly. However, when I try to start another instance of
> the client process and connect to the same service, this second
> connection attempt fails. The first connection remains active and
> continues to work. This second client would have registered its own
> client profile with a unique object path and the same target UUID.
>
> Is it possible for a single host to establish multiple connections to
> the same service?

First this can only work in case of L2CAP, RFCOMM you can only connect
once per channel, but it means the remote need to be able to accept
multiple connections using the same PSM and each of it will be mapped
to different scid/dcid pair per socket, but we currently don't allow
multiple connections to the same profile since that would probably
need more states and perhaps call NewConnection multiple times.

Also if you do register a second instance of the same UUID it will
probably have to use a different channel/psm, that perhaps is easier
to setup given you can use RFCOMM but the remote will need to be able
to distinguished between 2 different instances of the SDP record.

Either way there is still the problem of how many connections should
we attempt with ConnectProfile in this case, with just one psm right
now it is impossible to tell how many connection should it create, and
with multiple instances I think it currently only connect to the first
one, and even if we decide to connect to all of them we will have to
decide how we would be doing it since they could be connected in
parallel or just one after the other.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-14 12:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 23:45 Multiple client connections? Mark Spruiell
2015-10-14 12:38 ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.