[英]Transfer data between two Android using Wifi
I'm trying to develop an Android application which have to be able to transfer data/message between two Android mobiles, as a client server connection using their own Wifi, which having no network or routers nearby. 我正在尝试开发一个Android应用程序,该应用程序必须能够使用自己的Wifi作为客户端服务器连接,在两个Android移动设备之间传输数据/消息,而Wifi在附近没有网络或路由器。 I just tried using Tcp program to do this but it fails, its not connecting, I'm getting ConnectException and connection refused. 我只是尝试使用Tcp程序来执行此操作,但是它失败了,无法连接,我收到了ConnectException并且连接被拒绝。
[Edited] Is it possible to achieve this using Android Portable Hotspot integrated with application? [编辑]是否可以使用与应用程序集成的Android Portable Hotspot实现此目的? Is there any tutorial regarding this approach? 是否有关于此方法的教程?
Any Ideas, how to do this? 任何想法,该怎么做? Thanks. 谢谢。
You need to get the two devices networked to each other before you can worry about tcp usage of that network connection. 您需要将两个设备互相联网,然后才能担心该网络连接的tcp使用情况。
If one device is willing to perform access-point like functionality as part of a portable hotspot, and you select that as a wirelss network on the other, you may achieve a network connection between the two that can be used for custom traffic. 如果一台设备愿意作为便携式热点的一部分执行类似接入点的功能,并且选择将其作为另一台设备的无线网络,则可以在两者之间实现可用于自定义流量的网络连接。 Though there are ways the hotspot could be implemented where that would not work. 尽管有一些方法可以在无法解决问题的地方实施热点。 Also of concern, the "client" device will now be sending all of its network traffic through the hotspot device, including not just foreground apps but anything it decides to do in the background. 同样值得关注的是,“客户端”设备现在将通过热点设备发送其所有网络流量,不仅包括前台应用程序,还包括它决定在后台执行的任何操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.