一个 Wi-Fi 网络中 iOS 应用程序之间的通信(无需服务器)

发布于 2024-12-28 18:59:23 字数 104 浏览 1 评论 0原文

我需要将我的应用程序与 2 台设备进行通信。一项限制是我无法使用服务器,但所有 iOS 设备都将位于一个 Wi-Fi 网络中。我有什么选择?如何向另一台设备上运行的应用程序的另一个副本发送消息?

I need to communicate my app with 2 devices. A restriction is that I can't use a server but all iOS devices will be in one Wi-Fi network. What options do I have? How I can send a message to another copy of my app running on another device?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

内心激荡 2025-01-04 18:59:23

我不知道这是否是正确的方法,但由于你不能使用服务器,所以我能想到的方法是我们可以使用 TCP/IP 或 UDP(基于可靠性)创建套接字连接进行数据交换。

I dont know whether its a correct approach or not but as you cannot use server,so the approach i can think of is we can create a socket connection using TCP/IP or UDP(based on reliability) for data exchange.

我们只是彼此的过ke 2025-01-04 18:59:23

我认为如果没有某种服务器应用程序,您就无法在运行同一应用程序的两个设备之间进行通信。

即使您可以通过 WIFI 找到其他设备,我认为您也无法判断其他设备是否正在运行该应用程序。

I dont think you can communicate between 2 devices running the same application without having some kind of server application in-between.

Even if you could find the other device over the WIFI I dont think you can tell if the other device is running the app or not.

戒ㄋ 2025-01-04 18:59:23

我想你可能指的是 MultipeerConnectivity

多点连接框架为发现提供支持
附近的 iOS 设备使用基础设施 Wi-Fi 提供的服务
网络、点对点 Wi-Fi 和蓝牙个人区域网络以及
随后通过发送与这些服务进行通信
基于消息的数据、流数据和资源(例如文件)。

来源: https://developer.apple.com/library/ios/文档/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/

Apple 示例:
https://developer.apple.com/library/ios/samplecode /MultipeerGroupChat/Introduction/Intro.html

I think you may be referring to MultipeerConnectivity

The Multipeer Connectivity framework provides support for discovering
services provided by nearby iOS devices using infrastructure Wi-Fi
networks, peer-to-peer Wi-Fi, and Bluetooth personal area networks and
subsequently communicating with those services by sending
message-based data, streaming data, and resources (such as files).

Source: https://developer.apple.com/library/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/

Apple Sample:
https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文