t.i.i.ITransport(Interface) : interface documentation

Part of twisted.internet.interfaces View Source View In Hierarchy

Known subclasses: twisted.conch.insults.insults.ITerminalTransport, twisted.conch.telnet.ITelnetTransport, twisted.internet.interfaces.IProcessTransport, twisted.internet.interfaces.ITCPTransport, twisted.internet.interfaces.IUNIXTransport

Known implementations: twisted.conch.ssh.channel.SSHChannel, twisted.conch.ssh.session.SSHSessionProcessProtocol, twisted.internet._posixstdio.StandardIO, twisted.internet._win32stdio.StandardIO, twisted.internet.abstract.FileDescriptor, twisted.internet.iocpreactor.abstract.FileHandle, twisted.internet.protocol.FileWrapper, twisted.protocols.loopback._LoopbackTransport, twisted.protocols.loopback.LoopbackRelay, twisted.trial._dist.worker.LocalWorkerTransport

I am a transport for bytes.

I represent (and wrap) the physical connection and synchronicity of the framework which is talking to the network. I make no representations about whether calls to me will happen immediately or require returning to a control loop, or whether they will happen in the same or another thread. Consider methods of this class (aside from getPeer) to be 'thrown over the wall', to happen at some indeterminate time.

Method write Write some data to the physical connection, in sequence, in a non-blocking fashion.
Method writeSequence Write a list of strings to the physical connection.
Method loseConnection Close my connection, after writing all pending data.
Method getPeer Get the remote address of this connection.
Method getHost Similar to getPeer, but returns an address describing this side of the connection.
def write(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.

def writeSequence(data): (source)
Write a list of 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 string.

def loseConnection(): (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 getPeer(): (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.

ReturnsAn IAddress provider.
def getHost(): (source)
Similar to getPeer, but returns an address describing this side of the connection.
ReturnsAn IAddress provider.
API Documentation for Twisted, generated by pydoctor at 2012-12-26 12:18:15.