         try flush(never)
     }
 
+    public func flush(deadline: Deadline) throws {
+        let socket = try getSocket()
+        try assertNotClosed()
+        
+        tcpflush(socket, deadline)
+        try TCPError.assertNoError()
+    }
+
     public func send(data: Data, flush: Bool = true, deadline: Deadline = never) throws {
         let socket = try getSocket()
         try assertNotClosed()

        if flush {
            try self.flush()
        }
    }

    public func flush(deadline: Deadline = never) throws {
        let socket = try getSocket()
        try assertNotClosed()
        
        tcpflush(socket, deadline)
        try TCPError.assertNoError()
    }

    public func receive(upTo byteCount: Int, deadline: Deadline = never) throws -> Data {

        try TCPError.assertNoReceiveErrorWithData(data, bytesProcessed: bytesProcessed)
        return Data(data.prefix(bytesProcessed))
    }
    
    public func close() -> Bool {
        guard let socket = self.socket else {
