且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

机器人 - 两个设备之间的通信

更新时间:2023-11-19 09:01:10

您可以通过蓝牙使用BluetoothSockets将它们连接起来。 Android开发者网站上有关于这个pretty的很好的文档。

You can connect them via bluetooth using BluetoothSockets. Android developer website has pretty good documentation on this.

http://developer.android.com/guide/topics/wireless/bluetooth.html

或者如果你宁愿(并有互联网在两台设备上),你可以使用普通插座的。

Or if you'd rather (and have internet on both devices), you can use regular Socket's.

http://developer.android.com/reference/java/net/ServerSocket.html用于服务器端 http://developer.android.com/reference/java/net/Socket.html对于客户端

http://developer.android.com/reference/java/net/ServerSocket.html for server side http://developer.android.com/reference/java/net/Socket.html for client side

如果您有大量的数据传输,网络插座有一个更大的数据容量和速度会更快。另一个优点是,有没有这样的事情超出范围。您可以连接两台设备随时随地上网是可用的,而与蓝牙他们必须彼此蓝牙范围

If you have a large amount of data to transfer, internet sockets have a greater data capacity and will be faster. The other advantage is that there is no such thing as "out of range". You can connect the two devices wherever internet is available, whereas with bluetooth they have to be within bluetooth range of each other