Closed ims-tech closed 5 years ago
static func testServer() {
DispatchQueue.global(qos: .background).async { let server = TCPServer(address: "127.0.0.1", port: 2442) switch server.listen() { case .success: while true { if let client = server.accept() { self.echoService(client: client) } else { print("accept error") } } case .failure(let error): print(error) } } }
static func echoService(client: TCPClient) { print("Newclient from:(client.address)[(client.port)]") let d = client.read(3) client.send(data: d!) client.close() }
static func testServer() {
static func echoService(client: TCPClient) { print("Newclient from:(client.address)[(client.port)]") let d = client.read(3) client.send(data: d!) client.close() }