CFNetwork and Bonjour integration for iPhone to Mac integration

帅比萌擦擦* 提交于 2019-11-26 08:45:29

问题


I want to use CFNetwork and Bonjour in conjunction to be able to have communications between my iPhone app and a Mac app. The app on the iPhone would have one button. Then on the Mac app, there will be a label. If the button is pushed on the iPhone app, the label changes on the Mac app.

Is there example code out there that can do this? If not, can someone lead me in the right direction?

Thanks!


回答1:


Bill Dudney created a sample iPhone Bonjour application to demonstrate how to use Bonjour to discover and connect to two iPhones. I ported this example to the Mac to demonstrate how to do Bonjour discovery between the two platforms. Bill also provides a nice writeup of how he put together the Bonjour wrapper used in this example.

This is a very simple example, and with the Mac and iPhone clients it does something similar to what you want. Only minor modifications should be needed.

I show this in action in the video for the Networking session of my Advanced iPhone Development course on iTunes U.




回答2:


Here i have created some simple sample application which exchange the data between iPhone and iMAC.

https://github.com/boobalaninfo/Bonjour-iOS-MAC-Apps



来源:https://stackoverflow.com/questions/3240617/cfnetwork-and-bonjour-integration-for-iphone-to-mac-integration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!