SwiftSocket library provides as easy to use interface for socket based connections on server or client side. Supports both TCP and UDP sockets.
Here are two demos for https://github.com/swiftsocket/SwiftSocket
How to run: 1、Run SocketServerDemo on simulator. 2、Run SocketClientDemo on simulator. 3、Click [Client connect server] button on SocketClientDemo's simulator.