================================= About ================================= A python interface to sendfile(2) system call: http://code.google.com/p/py-sendfile/ ================================= Install ================================= $ sudo setup.py install ...or: $ easy_install py-sendfile ================================= Supported platforms ================================= Linux OSX FreeBSD Dragon Fly BSD SunOS AIX (non properly tested) Python versions from 2.4 to 3.2 by using a single code base. ================================= Example usage ================================= import socket import errno from sendfile import sendfile file = open("somefile", "rb") sock = socket.socket() sock.connect(("127.0.0.1", 8021)) offset = 0 while 1: try: sent = sendfile(sock.fileno(), file.fileno(), offset, 4096) except OSError, err: if err.errno == errno.EAGAIN: # retry continue raise else: if sent == 0: break # done offset += sent ================================= Authors ================================= py-sendfile was originally written by Ben Woolley including Linux and FreeBSD support. Later on Niklas Edmundsson took over maintenance and added AIX support. It's been completely rewritten by Giampaolo Rodola' (g.rodola@gmail.com) who took over maintenance and added support for: - Python 3 - OSX - SunOS - FreeBSD flag argument - large files - Linux header/trailer support via TCP_CORK socket option - non-blocking sockets