Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`protocols`.`loopback``

module documentation
(source)

Testing support for protocols -- loopback between client and server.

Class | `LoopbackClientFactory` | Undocumented
Class | `LoopbackRelay` | Undocumented
Function | `collapsingPumpPolicy` | `collapsingPumpPolicy` is a policy which collapses all outstanding chunks into a single string and delivers it to the target.
Function | `identityPumpPolicy` | `identityPumpPolicy` is a policy which delivers each chunk of data written to the given queue as-is to the target.
Function | `loopbackAsync` | Establish a connection between `server` and `client` then transfer data between them until the connection is closed. This is often useful for testing a protocol.
Function | `loopbackTCP` | Run session between server and client protocol instances over TCP.
Function | `loopbackUNIX` | Run session between server and client protocol instances over UNIX socket.
Class | `_FireOnClose` | Undocumented
Class | `_LoopbackAddress` | Undocumented
Class | `_LoopbackQueue` | Trivial wrapper around a list to give it an interface like a queue, which the addition of also sending notifications by way of a Deferred whenever the list has something added to it.
Class | `_LoopbackTransport` | No class docstring; 0/3 instance variable, 0/1 class variable, 1/10 method documented
Function | `_loopbackAsyncBody` | Transfer bytes from the output queue of each protocol to the input of the other.
Function | `_loopbackAsyncContinue` | Undocumented

def collapsingPumpPolicy(queue, target): (source)

`collapsingPumpPolicy` is a policy which collapses all outstanding chunks into a single string and delivers it to the target.

See Also
`loopbackAsync`

def identityPumpPolicy(queue, target): (source)

`identityPumpPolicy` is a policy which delivers each chunk of data written to the given queue as-is to the target.

This isn't a particularly realistic policy.

See Also
`loopbackAsync`

def loopbackAsync(server, client, pumpPolicy=identityPumpPolicy): (source)

Establish a connection between `server` and `client` then transfer data between them until the connection is closed. This is often useful for testing a protocol.

Parameters
server | The protocol instance representing the server-side of this connection.
client | The protocol instance representing the client-side of this connection.

pumpPolicy

When either `server` or `client` writes to its transport, the string passed in is added to a queue of data for the other protocol. Eventually, `pumpPolicy` will be called with one such queue and the corresponding protocol object. The pump policy callable is responsible for emptying the queue and passing the strings it contains to the given protocol's `dataReceived` method. The signature of `pumpPolicy` is `(queue, protocol)`. `queue` is an object with a `get` method which will return the next string written to the transport, or `None` if the transport has been disconnected, and which evaluates to `True` if and only if there are more items to be retrieved via `get`.

Returns
A `Deferred` which fires when the connection has been closed and both sides have received notification of this.

def loopbackTCP(server, client, port=0, noisy=True): (source)

Run session between server and client protocol instances over TCP.

def loopbackUNIX(server, client, noisy=True): (source)

Run session between server and client protocol instances over UNIX socket.

def _loopbackAsyncBody(server, serverToClient, client, clientToServer, pumpPolicy): (source)

Transfer bytes from the output queue of each protocol to the input of the other.

Parameters
server | The protocol instance representing the server-side of this connection.
serverToClient | The `_LoopbackQueue` holding the server's output.
client | The protocol instance representing the client-side of this connection.
clientToServer | The `_LoopbackQueue` holding the client's output.
pumpPolicy | See `loopbackAsync`.
Returns
A `Deferred` which fires when the connection has been closed and both sides have received notification of this.

def _loopbackAsyncContinue(ignored, server, serverToClient, client, clientToServer, pumpPolicy): (source)

Undocumented