class documentation

class LoopbackRelay: (source)

Implements interfaces: twisted.internet.interfaces.IConsumer, twisted.internet.interfaces.ITransport

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method clear​Buffer Undocumented
Method get​Host Similar to getPeer, but returns an address describing this side of the connection.
Method get​Peer Get the remote address of this connection.
Method log​Prefix Undocumented
Method lose​Connection Close my connection, after writing all pending data.
Method register​Producer Register to receive data from a producer.
Method unregister​Producer Stop consuming data from a producer, without disconnecting.
Method write Write some data to the physical connection, in sequence, in a non-blocking fashion.
Method write​Sequence Write an iterable of byte strings to the physical connection.
Class Variable disconnecting Undocumented
Instance Variable buffer Undocumented
Instance Variable log​File Undocumented
Instance Variable producer Undocumented
Instance Variable should​Lose Undocumented
Instance Variable target Undocumented
def __init__(self, target, logFile=None): (source)

Undocumented

def clearBuffer(self): (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 logPrefix(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 registerProducer(self, producer, streaming): (source)

Register to receive data from a producer.

This sets self to be a consumer for a producer. When this object runs out of data (as when a send(2) call on a socket succeeds in moving the last data from a userspace buffer into a kernelspace buffer), it will ask the producer to resumeProducing().

For IPullProducer providers, resumeProducing will be called once each time data is required.

For IPushProducer providers, pauseProducing will be called whenever the write buffer fills up and resumeProducing will only be called when it empties. The consumer will only call resumeProducing to balance a previous pauseProducing call; the producer is assumed to start in an un-paused state.

Parameters
producerUndocumented
streamingTrue if producer provides IPushProducer, False if producer provides IPullProducer.
Raises
RuntimeErrorIf a producer is already registered.
def unregisterProducer(self): (source)
Stop consuming data from a producer, without disconnecting.
def write(self, data): (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
dataThe 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

buffer: bytes = (source)

Undocumented

logFile = (source)

Undocumented

producer = (source)

Undocumented

shouldLose: int = (source)

Undocumented

target = (source)

Undocumented