class documentation

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__ No summary
Method __repr__ Undocumented
Method abortConnection For the time being, this is the same as loseConnection; no buffered data will be lost.
Method bufferReceived Undocumented
Method getHost Similar to getPeer, but returns an address describing this side of the connection.
Method getOutBuffer Get the pending writes from this transport, clearing them from the pending buffer.
Method getPeer Get the remote address of this connection.
Method getTcpKeepAlive Return if SO_KEEPALIVE is enabled.
Method getTcpNoDelay Return if TCP_NODELAY is enabled.
Method logPrefix Identify this transport/event source to the logging system.
Method loseConnection Close my connection, after writing all pending data.
Method loseWriteConnection Half-close the write side of a TCP connection.
Method pauseProducing Undocumented
Method registerProducer From abstract.FileDescriptor
Method reportDisconnect Undocumented
Method resumeProducing Undocumented
Method setTcpKeepAlive Enable/disable SO_KEEPALIVE.
Method setTcpNoDelay Enable/disable TCP_NODELAY.
Method startTLS Initiate TLS negotiation.
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 closed Undocumented
Class Variable disconnected Undocumented
Class Variable disconnectReason Undocumented
Instance Variable disconnecting Undocumented
Instance Variable hostAddress Undocumented
Instance Variable isServer Undocumented
Instance Variable peerAddress Undocumented
Instance Variable producer Undocumented
Instance Variable protocol Undocumented
Instance Variable serial Undocumented
Instance Variable stream Undocumented
Instance Variable streamingProducer Undocumented
Instance Variable tls Undocumented
Instance Variable tlsbuf Undocumented
Method _checkProducer Undocumented
Class Variable _nextserial Undocumented
def __init__(self, protocol, isServer, hostAddress=None, peerAddress=None): (source)
Parameters
protocol:IProtocol providerThis transport will deliver bytes to this protocol.
isServer:boolTrue if this is the accepting side of the connection, False if it is the connecting side.
hostAddress:IAddress provider or NoneThe value to return from getHost. None results in a new FakeAddress being created to use as the value.
peerAddress:IAddress provider or NoneThe value to return from getPeer. None results in a new FakeAddress being created to use as the value.
def __repr__(self): (source)

Undocumented

Returns
strUndocumented
def abortConnection(self): (source)

For the time being, this is the same as loseConnection; no buffered data will be lost.

def bufferReceived(self, buf): (source)

Undocumented

def getHost(self): (source)

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

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

Get the pending writes from this transport, clearing them from the pending buffer.

Returns
bytesthe bytes written with transport.write
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 getTcpKeepAlive(self): (source)

Return if SO_KEEPALIVE is enabled.

def getTcpNoDelay(self): (source)

Return if TCP_NODELAY is enabled.

def logPrefix(self): (source)

Identify this transport/event source to the logging system.

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 loseWriteConnection(self): (source)

Half-close the write side of a TCP connection.

If the protocol instance this is attached to provides IHalfCloseableProtocol, it will get notified when the operation is done. When closing write connection, as with loseConnection this will only happen when buffer has emptied and there is no registered producer.

def pauseProducing(self): (source)

Undocumented

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

From abstract.FileDescriptor

def reportDisconnect(self): (source)

Undocumented

def resumeProducing(self): (source)

Undocumented

def setTcpKeepAlive(self, enabled): (source)

Enable/disable SO_KEEPALIVE.

Enabling SO_KEEPALIVE sends packets periodically when the connection is otherwise idle, usually once every two hours. They are intended to allow detection of lost peers in a non-infinite amount of time.

def setTcpNoDelay(self, enabled): (source)

Enable/disable TCP_NODELAY.

Enabling TCP_NODELAY turns off Nagle's algorithm. Small packets are sent sooner, possibly at the expense of overall throughput.

def startTLS(self, contextFactory, beNormal=True): (source)

Initiate TLS negotiation.

Parameters
contextFactory:IOpenSSLClientConnectionCreator or IOpenSSLServerConnectionCreator, depending on whether this ITLSTransport is a server or not. If the appropriate interface is not provided by the value given for contextFactory, it must be an implementor of IOpenSSLContextFactory.

An object which creates appropriately configured TLS connections.

For clients, use twisted.internet.ssl.optionsForClientTLS; for servers, use twisted.internet.ssl.CertificateOptions.

beNormalUndocumented
def stopConsuming(self): (source)

Undocumented

def stopProducing(self): (source)

Undocumented

def unregisterProducer(self): (source)

Undocumented

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.

Undocumented

disconnected: int = (source)

Undocumented

disconnectReason = (source)

Undocumented

disconnecting: bool = (source)

Undocumented

hostAddress = (source)

Undocumented

isServer = (source)

Undocumented

peerAddress = (source)

Undocumented

producer = (source)

Undocumented

protocol = (source)

Undocumented

Undocumented

Undocumented

streamingProducer = (source)

Undocumented

Undocumented

Undocumented

def _checkProducer(self): (source)

Undocumented

_nextserial = (source)

Undocumented