如何通过WiFi发送数据?[英] How send data throgh WiFi?

本文是小编为大家收集整理的关于如何通过WiFi发送数据?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

在我的应用程序中,如果使用没有TCP的相同WiFi连接,我希望通过WiFi发送文件到多个用户.如何获取连接到指定的Wify的用户列表. 我尝试过样品,但我没有得到任何东西.

请帮助.

感谢

推荐答案

tcp是文件转移的一个很大的传输,我不认为你会想出一个不使用TCP开始的原因.所有Andriod设备都无法处理的文件传输协议,因此您仍然需要开发客户端.

除此之外,无论是否安装了用于安装目的的设备,都没有完全可以提供鲁棒和可靠的发现.每个客户都需要积极披露自己,或者被动地回复请求.

被动:每个设备可以使用实际ICMP(并不意味着它是一个已启用的设备),本地子网上的TCP或UDP报文.因此可以通过位发现响应客户端,甚至可以共享扫描结果.

活动:反向方法是使每个已启用的客户端发出组播数据报并侦听它们(类似于ARP Discovery如何工作).查看: http://developer.android.com/reference/java/net/multicastsocket .html

每个客户端将以某种结构化的,序列化方式侦听包含文件数据和元数据的传入TCP连接,并准备存储和/或处理这些.身份验证和授权的奖励积分.

已启用的客户端方法(具有客户端的设备),意味着您可以使用自己的发现和数据传输协议彼此交谈.

本文地址:https://www.itbaoku.cn/post/102779.html

问题描述

In my Application I want to send files through WiFi to multiple users if they are using the same WiFi connection Without TCP. how to get the list of the users who are connected to a specified wify. I have tried with Samples But I didn't get anything .

Please help.

Thanks

推荐答案

TCP is a great transport for file transfers, I don't think you'll ever come up with a reason to not use TCP to begin with. There is also no fancy built-in file-transfer protocol that all Andriod devices can handle, so you'll still need to develop a client.

Besides, robust and reliable discover is not entirely possible either without the devices having custom clients for your purposes installed. Each client would either need to actively disclose itself, or passively reply to requests.

Passive: each device can be "ping"ed using actual ICMP (does not mean it's an enabled device), TCP or UDP packets on the local subnet. Responding clients can thus be discovered bit by bit, and even share their scan results.

Active: a reverse approach would be to have each enabled client send out multicast datagrams and listen to them (similar to how ARP discovery works). See: http://developer.android.com/reference/java/net/MulticastSocket.html

Each client would then listen for incoming TCP connections with your file data and meta data in some structured, serialized manner and be ready to store and/or process these. Bonus points for authentication and authorization.

The enabled client approach (a device with a client), means that you can potentially develop cross-platform clients and have them talk to one another using your own discover and data transfer protocols.