eonil
eonil

Reputation: 86075

What's the most simple way to bi-directional communication between iOS and Mac OS X?

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!

-- edit --

  1. This is a kind of fast prototyping of internal/in-house remote controller. Low latency is best, but not required.
  2. Binary formatted data, but not so heavy. Most of them are short control messages, and sometimes big chunks exceptionally.
  3. On Cocoa / Cocoa touch. Platforms are limited to them.
  4. Two peers are on LAN or at least WiFi network. So I can assume the connection is basically fast.
  5. Compatibility to unknown hosts, high efficiency/performance/reliability and such things are no need to be considered. Just simplicity is most important now.

Upvotes: 1

Views: 610

Answers (1)

bbum
bbum

Reputation: 162722

Without knowing acceptable latency, amount of data, type of data, and/or network topology (same LAN? routing over WAN?), it is impossible to say.

For most purposes, HTTP provides an awfully big and versatile hammer. And HTTP is supported by just about everything.


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.

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.

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).

However, the requirements on your non-Cocoa Touch side may dictate otherwise.

Upvotes: 4

Related Questions