class documentation

class UNIXStringTransport: (source)

Implements interfaces: twisted.internet.interfaces.IUNIXTransport

View In Hierarchy

An in-memory implementation of interfaces.IUNIXTransport which collects all data given to it for later inspection.

Method __init__ No summary
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 loseConnection Close my connection, after writing all pending data.
Method sendFileDescriptor Send a duplicate of this (file, socket, pipe, etc) descriptor to the other end of this connection.
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.
Instance Variable _fuzz Undocumented
Instance Variable _queue A list of the data which has been given to this transport, eg via write or sendFileDescriptor. Elements are two-tuples of a string (identifying the destination of the data) and the data itself.
def __init__(self, descriptorFuzz): (source)
Parameters
descriptorFuzz:intAn offset to apply to descriptors.
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 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 sendFileDescriptor(self, descriptor): (source)

Send a duplicate of this (file, socket, pipe, etc) descriptor to the other end of this connection.

The send is non-blocking and will be queued if it cannot be performed immediately. The send will be processed in order with respect to other sendFileDescriptor calls on this transport, but not necessarily with respect to write calls on this transport. The send can only be processed if there are also bytes in the normal connection-oriented send buffer (ie, you must call write at least as many times as you call sendFileDescriptor).

Parameters
descriptorAn int giving a valid file descriptor in this process. Note that a file descriptor may actually refer to a socket, a pipe, or anything else POSIX tries to treat in the same way as a file.
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, seq): (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
seqUndocumented
dataThe data to write.

Undocumented

A list of the data which has been given to this transport, eg via write or sendFileDescriptor. Elements are two-tuples of a string (identifying the destination of the data) and the data itself.