Search code examples
iphoneiosnetwork-programmingserviceipod

Communicating with Windows from an iPhone/iPod


I'm looking to work on an iOS app that would need to send/receive data back and forth between the iPhone/iPod and a service that is running on Windows. Communication-wise, I will be using sockets.

  • The Phone will send/receive data to/from a Windows service (NOT a web service)
  • Sockets will be used as a means for communication
  • The iPhone/iPod will be connected to WiFi using a static IP address
  • The iPhone/iPod is intended to be as thin client as possible

The intention is to have the Windows Service listen for events from iPhone/iPod. Example:

Input needs to be taken from a UITextField and saved as a string by pressing a button. On the button press, an event must be fired and sent to the Windows Service over WiFi, which will then receive the event, perform a "server-side" action, and send the response back to the iPhone/iPod.

I'm pretty new to iOS development still and I know this is some more advanced stuff, but any help or resources that would help to accomplish this, I'd appreciate it.

Thanks!


Solution

  • This is standard network stuff not related to which platform you're using. On iOS you can do either:

    1) use berkley sockets (standard unix stuff). 2) use the Cocoa wrapper for sockets (NSSocketPort etc). 3) use a framework such as MKNetworkKit (here).

    I would use option 3 myself :)

    One thing in your favour is that Windows machines and iPads are both little-endian, so you don't have to worry about byte-swapping (which you won't anyway if you're just sending strings).

    EDIT: For windows to discover your device, you will need either a configuration setup with the IP address details, or to use Apple's bonjour service, or some custom solution.