TCP - noppoMan/Suv GitHub Wiki

TCP Server

Check out the TCP Server Documentation

TCP Client

let client = TCP()
client.connect(Address(host: "127.0.0.1", port: 3000)) { res in
    if case .Success = res {
        client.write(Buffer("ping"))

        client.read { res in
            if case .Data(let buf) = res {
                print(buf.toString()!) // => pong
            }
        }

        client.shutdown() // close connection
        client.close() // close stream handle
    }
}