iPhone实现设备到设备通信的最佳方法 [英] iPhone best method to achieve device-to-device communication

查看:26
本文介绍了iPhone实现设备到设备通信的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序中实现实时设备到设备通信的最佳方法是什么?我一直在试验 Apple 推送通知服务,但发现它在实时消息传递方面充其量是参差不齐的.有没有办法为此使用套接字,还是我只是坚持使用 APNS?

What would be the best method to achieve realtime device to device communication within an application? I've been experimenting with the Apple Push Notification Service but find it spotty at best for realtime messaging. Is there a way to utilize sockets for this or am I just stuck into using the APNS?

推荐答案

如果您是初学者,请使用 GameKit.

If you are a beginner, use GameKit.

如果您厌倦了,请使用 AsyncSocket.

When you get sick of that, use AsyncSocket.

GameKit 非常简单,孩子可以使用它;AsyncSocket 可能是所有平台上所有网络中最漂亮的库 - 非常易于使用.

GameKit is so simple a child can use it; AsyncSocket is probably the most beautiful library in all of networking on any platforms - incredibly easy to use.

在这两种情况下,您将首先使用 Bonjour(两行代码)来查找"另一台设备.

In both cases, you will first use Bonjour (two lines of code) to "find" the other device.

这里是完整的解释...平板电脑(iPad/Android)-服务器通信协议

Here is the full explanation... Tablet(iPad/Android)-Server Communication Protocol

您将需要的有关 GK 的重要秘密知识...
客户端/服务器 GKSessions

Critical secret knowledge about GK you will need...
Client/Server GKSessions

另一个快速总结...
在 Mac/iPhone 上进行联网的最有效方式?

根据记录,APNS 与您要实现的目标完全没有任何关系!完全忘记 APNS.

For the record, APNS has absolutely nothing whatsoever to do with what you are trying to achieve! Utterly forget about APNS.

什么是半径?-----------------------***

WHAT IS THE RADIUS? -----------------------***

请注意,蓝牙只能在大约 20 英尺以上使用.(十米.)

Please note that BLUETOOTH ONLY WORKS over about twenty feet. (Ten meters.)

请注意,对于本地 WiFi 连接,您必须连接到同一个本地 WiFi 集线器.WiFi 集线器的范围可能只有 20 米,比如说只有一所房子和隔壁房子(取决于墙壁的厚度).

Please note that for a local WiFi connection, you must both be connected to the same local WiFi hub. WiFi hubs have a range of perhaps 20 meters only, say one house and the next house only (depending on how thick the walls are).

请注意:物理上不可能将两台计算机(任何类型的)连接几英里.

Please note that: IT IS NOT PHYSICALLY POSSIBLE TO CONNECT TWO COMPUTERS (OF ANY TYPE) OVER A COUPLE OF MILES.

没有这样的网络设备.(您也许可以使用业余无线电"来构建一个,但需要明确的是,这将是一个全新的研究项目,需要大公司数年才能完成.)

There is no such networking device. (You could perhaps build one using say "ham radio" but to be clear it would be a completely novel, new research project that would take a large company years to complete.)

绝对没有这样的事情 - 我很抱歉地告诉你这个坏消息.

There is absolutely nothing that works like that - I'm sorry to tell you the bad news.

仅有的两种可能性是蓝牙和 WiFi,它们分别只能在大约 20 和 30 英尺的范围内工作.

The ONLY two possibilties are Bluetooth and WiFi, and they work only over about 20 and 30 feet respectively.

那么你如何像这样连接两台远程计算机?答案是,通过互联网.

So how do you connect two remote computers like that? The answer is, via the internet.

唯一的方法是使用互联网连接.任何现有技术都不可能有直接"联系.

如果您需要了解更多有关如何使用互联网连接两台计算机(比如两台 iPhone)的信息,您可能需要提出一个新问题!您会很高兴知道这很容易,而且不会给您带来什么麻烦.

If you need to know more about how to connect two computers (say two iPhones) using the internet, you will probably have to ask a new question! You will be pleased to know it is very easy and will cause you little trouble.

请注意,两部 iPhone 都必须具有良好的稳定互联网连接.如果它们彼此相距超过 30 英尺,则连接到 iPhone 的唯一方法是通过互联网.他们每个人都必须有良好的互联网连接,否则不可能.

Note that both iPhones MUST have a good solid internet connection. If they are more than say 30 feet away from each other, the ONLY way to connect to iPhones is via the internet. THey must each have a good internet connection, or there is no possibility.

我希望这有助于澄清事情!

I hope this helps clarify things!

这篇关于iPhone实现设备到设备通信的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆