On Aug 2, 2012, at 4:29 PM, Kevin Bracey < email@hidden> wrote: The Apps I'm looking at involve a classroom situation, Local WiFi, Teacher with a MacBook and students with iOS devices, Questions and Answers going back and forth. I so I can focus on Cocoa level code with XML data?
HTTP probably isn't going to be a good fit for this, because Cocoa only has APIs for the client side. To communicate over HTTP, one side has to be the server, and that pretty much has to be implemented from scratch; there are some open-source frameworks for it like CocoaHTTPServer but they're somewhat complex to use.
Another possibility is to write the server (teacher) side as a real web-app, i.e. in PHP or Ruby or Python or something. These languages have high-level support for acting as servers, and while the clients are usually web browsers they don't have to be; they can be iOS apps sending custom HTTP requests.
Or you can skip HTTP and send requests and responses over TCP sockets using some custom protocol; I think this is what some of Apple's examples do. This is reasonably straightforward if you have a really trivial protocol like "client sends a request ending in a newline; server sends a response and closes the socket", but when you try to get more sophisticated you find yourself running into all the protocol issues that have been dealt with already by other protocols like message framing and pipelining and so forth.
Plug: I have a library called MYNetwork that implements a lot of this stuff and exposes a pretty simple high-level API to the app, where it can send messages as data blobs and get responses back without worrying about how the bits go across the wire.
—Jens |