views:

59

answers:

1

Hi,

I am wondering how I can send data between a machine and a mobile device. I know about the game kit an have read a bit about bonjour (but don't know to much about it), but would like to know some expert thoughts on what the best way is.

What I basically want to build is a one way traffic application that sends data from OSX to the mobile device (iPhone, iPod touch or iPad). The data send is either pictures, text (of a certain size and position ect) or video. The mobile device just has to receive this data and display it... nothing more. My guess is that a WiFi solution would be best.

How could I best do this? Are there any tutorials that might help me putting this together?

Thanks in advance!

Best regards,
Paul Peelen

+1  A: 

As no reply yet . . .

Bonjour is more focused on LAN networks, so would restrict you to WiFi.

It's also more of a service discovery standard - your Mac app would advertise the service on the LAN, and clients could see it - but your actual app communications will run on a different TCP socket, using whatever protocol is appropriate.

This linked answer may be helpful (although you will want CFNetwork in reverse - pushing from Mac to phone)

http://stackoverflow.com/questions/1187031/iphone-how-send-output-stream-via-wireless-network

For video you are probably better off looking for higher level frameworks (i.e. the AV ones).

Without knowing the full details of what you want to do, I wonder if rather than pushing data to the iPhone, the best thing would be to send a lightweight notification to the iPhone (AMQP, XMPP, or similar protocol) passing a URL back to the resource on the Mac - that way you could use standard HTTP GET for images, video, etc, on the iPhone side, throw the URL at a webkit view to display - and on your Mac side you could then use an off-the-shelf web server (Apache, or an embedded HTTP server within your code).

JulesLt
Thank you for your answer. I thought of the last option (webservice), but I want to be able to control one (or several) devices at the same time giving them an "assignment". This could either be a show a color on the screen for a certain amount of time, show an image and move it.. show part of an image ect. a webkit view doesn't work for that... also for larger files i guess streaming would be best. The most important thing is that it works on the fly and with webservices and might have some lag. WiFi only is not a problem.I'll have a look at the link, thnx.
Paul Peelen
You're going to need a protocol for pushing the files out to the clients then. This is dead easy between Macs http://dotnetaddict.dotnetdevelopersjournal.com/do_bonjour_pbcup.htm but Distributed objects isn't in iOS (I may be wrong with 4.0).
JulesLt
Seems that this easy thing is getting quite big =PI might have to get me some books to master this. Thanks for your help!
Paul Peelen
To keep it easy, you definitely want to build on top of existing communications libraries.To push binary data from the Mac, you need to have something running on the iPhone end that can understand everything you send (including communication errors!). HTTP/MIME already supports the types of data you want to send so I would try to work above that level. GameKit look like it has to supports moving arbitrary data between devices in an easy manner, but investigation suggests GameKit messages should be less than 1Kb - and is Bluetooth based.
JulesLt