问题
I would like to create a server/client application where one iphone is running a server, and all other devices on the same wifi network can connect to the server device and send and receive information. Are there any examples of running a server on a device and letting other devices on the network search for it?
I looked into using GameKit, but the 16 person max limit is unfortunate. cocoaasyncsocket seems like a good option, but how do I set up one device as the server, and search for it on other devices?
回答1:
The WiTap sample code may be what you're looking for (or at least a good place to start):
http://developer.apple.com/library/ios/#samplecode/WiTap/Introduction/Intro.html
来源:https://stackoverflow.com/questions/8114865/any-examples-of-a-server-client-iphone-app-where-both-the-server-and-clients-are