views:

153

answers:

3

I'm new to writing networking software and am looking for a high-level point in a direction.

I've been playing with writing code for both Java and the iPhone (independently, of course) for a few months now and would like to write an iPhone app that can communicate with a target PC. My "end-game" is to create an iPhone remote control for a PC based application written in Java.

My question is: Where do I start? Is it better to create a web-server on the PC side or to send pure socket-based messages between the two "machines"?

My PC will be the server and the iPhone will be the client.

A: 

How complex is the application view you're after, can it be represented by a webpage? e.g. can the application on the PC show the controls/data it needs via an iPhone sized webpage? If so that's the simplest approach to the problem with minimal development time.

Nick Craver
A: 

If you are looking only to send remote commands from the iPhone to the server, often it is enough to go with a stateless protocol like UDP. It allows you to send the message without setting up a connection before hand. The only needed knowledge on the phone is the address of the server. To "discover" the address of the server, you might use Bonjour then you can name your service, rather than relying on the user to properly configure the connection.

Both UDP and Bonjour are well supported on iPhone and in Java.

NWCoder
+1  A: 

Apple's Getting Started with Networking provides a pretty good overview of the networking technologies in OSX.

MrNuB