SundayMonday
SundayMonday

Reputation: 19737

Communicate between iPhone and macbook laptop

In an effort to learn more about networking I'd like to do an exercise: write some code on an iPhone and macbook laptop that allows the devices to communicate over HTTP.

How would I set this up in general? I could write a very simple web server as illustrated in Beej's Guide. Then run this and make requests from the phone. Assume the two devices will be on the same wifi network.

Upvotes: 1

Views: 433

Answers (2)

3lvis
3lvis

Reputation: 4180

In this book you can find an example of how to make a network to connect a Mac OS X app with an iOS app using Bonjour.

http://my.safaribooksonline.com/book/programming/mobile/9780132757058/bonjour-and-web-servers/ch28

Hope this helps you.

Upvotes: 3

logancautrell
logancautrell

Reputation: 8772

Using HTTP between two apps is very inefficient. Use NSNetService and raw sockets.

NSNetService Docs

There is an example project that shows how to setup the service for publishing, connect 2 services, and consume data from a socket connection.

Upvotes: 1

Related Questions