             try self.flush()
         }
     }
-    
+
     public func flush(timingOut deadline: Double) throws {
         let socket = try getSocket()
         try ensureStreamIsOpen()

    public func send(_ data: Data, timingOut deadline: Double) throws {
        try send(data, flushing: true, timingOut: deadline)
    }
    
    public func send(_ data: Data, flushing flush: Bool, timingOut deadline: Double) throws {
        let socket = try getSocket()
        try ensureStreamIsOpen()

        }

        if received == 0 {
          do {
            try ensureLastOperationSucceeded()
          } catch SystemError.connectionResetByPeer {
            throw StreamError.closedStream(data:Data(data.prefix(received)))
          }
        }

        return Data(data.prefix(received))
