+ end = len(header) - start
+ chunk[:end] = header[start:]
+ if python27_3: # When possible, use less memory by reading directly into the buffer.
+ buffer = memoryview(chunk)[end:] # Create a view into the bytearray to hold the rest of the chunk.
+ sock.recv_into(buffer)
+ else: # less efficient for python2.6 compatibility
+ chunk[end:] = sock.recv(max(0, size - end))