Swift:编写outputStream

时间:2019-06-21 16:16:50

标签: swift sockets tcp outputstream

我正在测试连接并向主机发送简单消息,并且已经使用了本指南enter image description here

到目前为止,当我尝试在输出流上进行写操作时,我就可以连接到服务器。

        let data : NSData = "hello".data(using: String.Encoding.utf8)! as NSData
        outStream?.write(UnsafePointer<UInt8>(data.bytes), maxLength: data.length)

我在write(UnsafePointer(data.bytes),...

无法将类型“ UnsafeRawPointer”的值转换为预期的参数类型“ RawPointer”

0 个答案:

没有答案