Android 可以进行点对点的点对点网络吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1932150/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:49:53  来源:igfitidea点击:

Can Android do peer-to-peer ad-hoc networking?

androidnetworkingwifip2padhoc

提问by Doughy

Is it possible to set up Android in ad-hoc peer-to-peer wifi mode? For example, I would like to have one phone broadcast a message, and have all peers in the network receive the broadcast, without having a server. I would like to use wifi since bluetooth range is more limited.

是否可以在点对点 wifi 模式下设置 Android?例如,我想让一部手机广播一条消息,并让网络中的所有对等方都收到广播,而无需服务器。我想使用 wifi,因为蓝牙范围更有限。

采纳答案by Crowe T. Robot

Here's a bug report on the feature you're requesting.

这是有关您请求的功能的错误报告。

It's status is "reviewed" but I don't believe it's been implemented yet.

它的状态是“已”,但我认为它尚未实施。

http://code.google.com/p/android/issues/detail?id=82

http://code.google.com/p/android/issues/detail?id=82

回答by Telmo Marques

Although Android can't find and connect to ad-hoc networks it sure can connect to Access Points. So as a work-around you can turn your Wireless Card into an Access Point using, for example, Connectify.

尽管 Android 无法找到并连接到 ad-hoc 网络,但它确实可以连接到接入点。因此,作为一种变通方法,您可以使用例如Connectify将您的无线卡变成接入点。

回答by Rabie Jradi

my friend and I are currently developing a java library implementing the AODV protocol (multihop routing suitable for mobile networks), in our bachelor thesis. The final 'product' includes a easy way to create/join an adhoc network on several android devices and an interface through the library, to send and receive messages. Unfortunately each type of phone such as hero, nexsus one... have a phonedepended way for createing a adhoc network so currently we are only supporting a few phones).

我和我的朋友目前正在我们的学士论文中开发一个实现 AODV 协议(适用于移动网络的多跳路由)的 Java 库。最终的“产品”包括一种在多个安卓设备上创建/加入临时网络的简单方法,以及一个通过库发送和接收消息的接口。不幸的是,每种类型的电话(例如 hero、nexsus one...)都有一种依赖于电话的方式来创建临时网络,因此目前我们只支持少数电话)。

this means that once this project is finished, people with rooted phones can implement their distributed applications (file sharing, games, ...) by simply including the library .jar file in their android projects.

这意味着一旦这个项目完成,拥有 root 手机的人可以通过简单地在他们的 android 项目中包含库 .jar 文件来实现他们的分布式应用程序(文件共享、游戏等)。

it's all open source by the way

顺便说一下,它都是开源的

http://code.google.com/p/adhoc-on-android/

http://code.google.com/p/adhoc-on-android/

回答by yanokwa

you can connect your android device to a known ad-hoc network.

您可以将您的 android 设备连接到已知的 ad-hoc 网络。

edit /system/etc/wifi/tiwlan.ini

编辑 /system/etc/wifi/tiwlan.ini

WiFiAdhoc = 1
dot11DesiredSSID = <your_network_ssid>
dot11DesiredBSSType = 0 

edit /data/misc/wifi/wpa_supplicant.conf

编辑/data/misc/wifi/wpa_supplicant.conf

ctrl_interface=tiwlan0
update_config=1
eapol_version=1
ap_scan=2

if that is too simplistic, see these instructions.

如果这太简单了,请参阅这些说明

回答by CGK

Support for peer to peer WiFi networking is available since API level 14.

API 级别 14起就可以支持对等 WiFi 网络。

回答by fatih

Your answer is Wi-Fi direct which is made available with ICS. Here is a link for explanation in Android doc

您的答案是 ICS 提供的 Wi-Fi direct。这是Android 文档中的解释链接

回答by fatih

It might work to use JmDNS on Android: http://jmdns.sourceforge.net/

在 Android 上使用 JmDNS 可能有效:http://jmdns.sourceforge.net/

There are tonsof zeroconf-enabled machines out there, so this would enable discovery with more than just Android devices.

那里有大量启用 zeroconf 的机器,因此这将启用不仅仅是 Android 设备的发现。

回答by Selvakumar

You can use Alljoynframework for Peer-to-Peer connectivity in Android. Its based on Ad-hoc networking and also Open source.

您可以在 Android 中使用Alljoyn框架进行点对点连接。它基于 Ad-hoc 网络,也是开源的。

回答by jaxvy

I don't think it provides a multi-hop wireless packet routing environment. However you can try to integrate a simple routing mechanism. Just check out Wi-Shareto get an idea how it can be done.

我不认为它提供了多跳无线数据包路由环境。不过你可以尝试集成一个简单的路由机制。只需查看Wi-Share即可了解如何实现。

回答by kreker

Yes, but:
1. root your device (in case you've got Nexus S like me, see this)
2. install root explorer (search in market)
3. find appropriate wpa_supplcant file and replace (and backup) original as shown in this thread

是的,但是:
1. 根你的设备(如果你有像我一样的 Nexus S,请看这个
2. 安装根资源管理器(在市场中搜索)
3. 找到合适的 wpa_supplcant 文件并替换(和备份)原始文件,如图所示这个线程

above was tested on my Nexus S I9023 android 2.3.6

以上是在我的 Nexus S I9023 android 2.3.6 上测试的