你可以建立的Andr​​oid相同的两个设备之间的多个蓝牙连接

你可以建立的Andr​​oid相同的两个设备之间的多个蓝牙连接

本文介绍了你可以建立的Andr​​oid相同的两个设备之间的多个蓝牙连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Android设备。一充当服务器和其他的客户。客户端连接到服务器并请求一个文件 - 这是在客户机上的一个线程和一个线程完成的服务器上这样既可以继续做他们想要什么

I have two Android devices. One is acting as a server and the other as a client. The client connects to the server and requests a file - this is done in one thread on the client and one thread on the server so that both can continue doing what they want.

然后,客户端尝试连接到服务器再次请求另一个文件。现在,我得到一个 java.io.IOException异常:设备或资源忙尝试连接时( socket.connect())。难道是因为蓝牙(Android上)只允许两个设备之间的一个通道? (如果它是另一装置,将工作,但如果它是同它不?)注意,这两个尝试以相同的服务名和UUID进行。

The client then attempts to connect to the server again to request another file. Right now I am getting a java.io.IOException: Device or resource busy when attempting to connect (socket.connect()). Is it because Bluetooth (on Android) only allows one channel between two devices? (if it were another device it would work but if it is the same it doesn't ?) Note that both attempts are made with the same service name and UUID.

即使错误是特定于我的code,我想知道,如果是这样的话还是不行。

Even if the error is specific to my code, I would like to know if this is the case or not.

系统:的Andr​​oid 2.2.1与bluecove蓝牙库通信。

System: android 2.2.1 communicating with the bluecove bluetooth library.

推荐答案

据我所知,多种连接是不可能的蓝牙连接的情况。蓝牙是连接API是默认同步所以只有一次一个连接是可能的。所以,你不能执行多个连接。

AFAIK, multiple connectivity is not possible in case of Bluetooth Connection. Bluetooth is Connectivity API is by default Synchronized so only one connection at a time is possible. So you can not perform multiple connections.

然而,它可以以另一种方式是可能的像进行一个连接时,执行其上2秒操作,然后创建另一个连接并执行像在正常多任务操作系统发生2秒操作。

However it can be possible in another way like making one connection , performing 2 seconds operation on it and then creating another connection and performing 2 seconds operations like in normal multitasking operating system happens.

这篇关于你可以建立的Andr​​oid相同的两个设备之间的多个蓝牙连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 16:26