我正在考虑将2个NSStream用于上/下声道.但是,它看起来有些复杂.如果您知道更简单的方法(或建议),请告诉我!
I'm considering using 2 NSStream for up/down channels. However, it looks somewhat complex. If you know simpler way (or recommendations) to do this, please let me know!
-编辑-
推荐答案
在不知道可接受的延迟,数据量,数据类型和/或网络拓扑(相同的LAN?通过WAN路由吗?)的情况下,
Without knowing acceptable latency, amount of data, type of data, and/or network topology (same LAN? routing over WAN?), it is impossible to say.
对于大多数用途,HTTP提供了一个巨大而通用的锤子. HTTP几乎受所有支持.
For most purposes, HTTP provides an awfully big and versatile hammer. And HTTP is supported by just about everything.
您想简单吗?没有什么比HTTP更加简单了,仅仅是因为它是一个无处不在的高级协议,每个人都实现了从高级API(例如NSHTTP */NSURL *)到不到1美元的嵌入式芯片的任何地方.
You want simple? Nothing is as simple as HTTP simply because it is a ubiquitous high level protocol that everyone and there brother has implemented anywhere from high level APIs (like NSHTTP*/NSURL*) down to less-than-$1 embedded chips.
如果要控制的设备具有HTTP服务器的选项,请执行该操作.当使用像HTTP这样的高级协议时,调试将变得非常简单,并且调试要容易得多.
If the devices you want to control have an option for an HTTP server, go for that. It'll be dead simple and debugging is much much easier when working with a high level protocol like HTTP.
在这一点上,很难不购买带有LAN/wLAN端口并且也没有HTTP服务器的设备(在我的头上,我的家庭影院)接收器,太阳能控制器,烧烤,打印机,安全摄像机,PS3,VOIP盒和U-verse路由器都具有HTTP服务器.
At this point, it is hard not to buy a device with a LAN/wLAN port that doesn't also have an HTTP server in it (off the top of my head, my home theater receiver, solar controller, bbq, printer, security camera, PS3, VOIP box, and U-verse router all have HTTP servers).
但是,非Cocoa Touch方面的要求可能另有规定.
However, the requirements on your non-Cocoa Touch side may dictate otherwise.
更多推荐
在iOS和Mac OS X之间进行双向通信的最简单方法是什么?
发布评论