class documentation

class FileWrapper: (source)

Constructor: FileWrapper(file)

Implements interfaces: twisted.internet.interfaces.ITransport

View In Hierarchy

A wrapper around a file-like object to make it behave as a Transport.

This doesn't actually stream the file to the attached protocol, and is thus useful mainly as a utility for debugging protocols.

Method __init__ Undocumented
Method getHost Similar to getPeer, but returns an address describing this side of the connection.
Method getPeer Get the remote address of this connection.
Method handleException Undocumented
Method loseConnection Close my connection, after writing all pending data.
Method pauseProducing Undocumented
Method registerProducer From abstract.FileDescriptor
Method resumeProducing Undocumented
Method stopConsuming Undocumented
Method stopProducing Undocumented
Method unregisterProducer Undocumented
Method write Write some data to the physical connection, in sequence, in a non-blocking fashion.
Method writeSequence Write an iterable of byte strings to the physical connection.
Class Variable disconnecting Undocumented
Instance Variable closed Undocumented
Instance Variable file Undocumented
Instance Variable producer Undocumented
Instance Variable streamingProducer Undocumented
Method _checkProducer Undocumented
def __init__(self, file): (source)

Undocumented

def getHost(self): (source)

Similar to getPeer, but returns an address describing this side of the connection.

Returns
An IAddress provider.
def getPeer(self): (source)

Get the remote address of this connection.

Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc.

Returns
An IAddress provider.
def handleException(self): (source)

Undocumented

def loseConnection(self): (source)

Close my connection, after writing all pending data.

Note that if there is a registered producer on a transport it will not be closed until the producer has been unregistered.

def pauseProducing(self): (source)

Undocumented

def registerProducer(self, producer, streaming): (source)

From abstract.FileDescriptor

def resumeProducing(self): (source)

Undocumented

def stopConsuming(self): (source)

Undocumented

def stopProducing(self): (source)

Undocumented

def unregisterProducer(self): (source)

Undocumented

def write(self, data: bytes): (source)

Write some data to the physical connection, in sequence, in a non-blocking fashion.

If possible, make sure that it is all written. No data will ever be lost, although (obviously) the connection may be closed before it all gets through.

Parameters
data:bytesThe data to write.
def writeSequence(self, iovec): (source)

Write an iterable of byte strings to the physical connection.

If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single byte string.

Parameters
iovecUndocumented
dataThe data to write.
disconnecting: int = (source)

Undocumented

Undocumented

Undocumented

producer = (source)

Undocumented

streamingProducer = (source)

Undocumented

def _checkProducer(self): (source)

Undocumented