     public func send(data: Data, flushing flush: Bool = true, deadline: Deadline = never) throws {
         let socket = try getSocket()
         try assertNotClosed()
-        
         let bytesProcessed = data.withUnsafeBufferPointer {
             tcpsend(socket, $0.baseAddress, $0.count, deadline)
         }
-
+        
         try TCPError.assertNoSendErrorWithData(data, bytesProcessed: bytesProcessed)
-
+        
         if flush {
             try self.flush()
         }
     }
 
+    public func receive(max byteCount: Int) throws -> C7.Data {
+        return try receive(upTo: byteCount, timingOut: never)
+    }
+
     public func receive(upTo byteCount: Int, timingOut deadline: Deadline = never) throws -> Data {
         let socket = try getSocket()
         try assertNotClosed()
-
+        
         var data = Data.bufferWithSize(byteCount)
         let bytesProcessed = data.withUnsafeMutableBufferPointer {
-            tcprecv(socket, $0.baseAddress, $0.count, deadline)
+            tcprecvlh(socket, $0.baseAddress, 1, $0.count, deadline)
         }
-
+        
         try TCPError.assertNoReceiveErrorWithData(data, bytesProcessed: bytesProcessed)
         return Data(data.prefix(bytesProcessed))
     }

        tcpclose(socket)
        return true
    }
    
    func getSocket() throws -> tcpsock {
        guard let socket = self.socket else {
            throw TCPError.closedSocket(description: "Socket has not been initialized. You must first open to the socket.")
        }
        return socket
    }
    
    func assertNotClosed() throws {
        if closed {
            throw TCPError.closedSocketError
        }
    }
    
    deinit {
        if let socket = socket where !closed {
            tcpclose(socket)

import C7

public final class TCPConnection: C7.Connection {

    public var uri: C7.URI
    var socket: tcpsock?
    public private(set) var closed = true

    public init(to uri: C7.URI) throws {
        self.uri = uri
    }

    public func open() throws {
        guard let host = uri.host else {
            throw TCPError.unknown(description: "Host was not defined in URI")
