class FileReader(protocol.Protocol):

    def __init__(self, filename):
        self.f = open(filename, 'rb')

def dataReceived(self, data):
    self.transport.write(data)

def connectionMade(self):
    fd = self.f.fileno()
setNonBlocking(fd)
Non-blocking file access with Twisted