简体   繁体   中英

How to create a Mac/PC server app that interacts with iPhone/iPad App?

Can someone please point me in the right direction to create a Mac/PC server app that runs in the background and connects to an iPad app over the local WiFi network?

No matter how I phrase a search on Google it just brings up various apps like Remote Mouse and whatnot and no tutorials or even a hint of where to start.

I just need to send simple commands from iPad to computer over local wifi. A point in the right direction and I can likely fill in the blanks.

Thank you.

Thomas

EDIT: I am using web languages for the iPad version that I will build as a native app using open source tools.

OK, then. It actually depends on what you really need. I made the assumption you need real-time and perhaps binary data transfer.

Your best bet is to write your server application using standard C or C++ so it compiles on both as simply as possible. If you want to avoid all the burden of writing a protocol for service discovery or asking users to enter the ip address of your server you will use a mDNS implementation for your server and your iPhone app.

If I were you I would try bonjour: http://www.apple.com/support/bonjour/ on iPhone You could start here: http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html

Once you have your sockets you will have to implement a networking protocol between your server application and your iPhone app. You will have to be careful about byte ordering and little subtle problems with latency, disconnections and other problems inherent to networking and WiFi.

In windows you will want to register your application as a service and in Mac OS X/UNIX you'll probably want to deamonize it.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM