ios - Server socket with swift -
this question has answer here:
- socket server example swift 2 answers
i want able have 1 ios-device multiple ios-devices (is there max?) able connect , send data(a string in case) first device.
i have tried tutorial: http://www.raywenderlich.com/3932/networking-tutorial-for-ios-how-to-create-a-socket-based-iphone-app-and-server have hard time understanding objective-c
actually, swift same objc. need port syntax objc swift:
func initnetworkcommunication() { var readstream : unmanaged<cfreadstream>?; var writestream : unmanaged<cfwritestream>?; cfstreamcreatepairwithsockettohost(nil, "localhost", 80, &readstream, &writestream); if let read = readstream { inputstream = readstream!.takeunretainedvalue() } if let write = writestream { outputstream = writestream!.takeunretainedvalue() } }
and on...
Comments
Post a Comment