0

I'm sending a video via OutputStream.write(_maxLength:) but the write method doesn't send all the data bytes but only a fixed amount every time. The total data count is videoData.count = 7357450 but the bytes written(returned by outputStream.write) is only 131768.

This is the method for writing to output stream.

extension OutputStream {
    func write(data: Data) -> Int {
        return data.withUnsafeBytes { write($0, maxLength: data.count) }
    }
}

Is there something wrong with the code? Is there a way to increase the .write capacity?

Note: This is not related to this question: Writing Data to an NSOutputStream in Swift 3. This question asks how to write while my question is about the limits of writing data.

AfnanAhmad
  • 183
  • 5
  • 14

0 Answers0