class documentation

class twisted.internet.protocol.ClientCreator: (source)

View In Hierarchy

Client connections that do not require a factory.

The various connect* methods create a protocol instance using the given protocol class and arguments, and connect it, returning a Deferred of the resulting protocol instance.

Useful for cases when we don't really need a factory. Mainly this is when there is no shared state between protocol instances, and no need to reconnect.

The connectTCP, connectUNIX, and connectSSL methods each return a Deferred which will fire with an instance of the protocol class passed to ClientCreator.__init__. These Deferred can be cancelled to abort the connection attempt (in a very unlikely case, cancelling the Deferred may not prevent the protocol from being instantiated and connected to a transport; if this happens, it will be disconnected immediately afterwards and the Deferred will still errback with CancelledError).

Method __init__ Undocumented
Instance Variable reactor Undocumented
Instance Variable protocolClass Undocumented
Instance Variable args Undocumented
Instance Variable kwargs Undocumented
Method connectTCP Connect to a TCP server.
Method connectUNIX Connect to a Unix socket.
Method connectSSL Connect to an SSL server.
Method _connect Initiate a connection attempt.
def __init__(self, reactor, protocolClass, *args, **kwargs): (source)

Undocumented

reactor = (source)

Undocumented

protocolClass = (source)

Undocumented

args = (source)

Undocumented

kwargs = (source)

Undocumented

def _connect(self, method, *args, **kwargs): (source)

Initiate a connection attempt.

ParametersmethodA callable which will actually start the connection attempt. For example, reactor.connectTCP.
argsPositional arguments to pass to method, excluding the factory.
kwargsKeyword arguments to pass to method.
ReturnsA Deferred which fires with an instance of the protocol class passed to this ClientCreator's initializer or fails if the connection cannot be set up for some reason.
def connectTCP(self, host, port, timeout=30, bindAddress=None): (source)

Connect to a TCP server.

The parameters are all the same as to IReactorTCP.connectTCP except that the factory parameter is omitted.

ReturnsA Deferred which fires with an instance of the protocol class passed to this ClientCreator's initializer or fails if the connection cannot be set up for some reason.
def connectUNIX(self, address, timeout=30, checkPID=False): (source)

Connect to a Unix socket.

The parameters are all the same as to IReactorUNIX.connectUNIX except that the factory parameter is omitted.

ReturnsA Deferred which fires with an instance of the protocol class passed to this ClientCreator's initializer or fails if the connection cannot be set up for some reason.
def connectSSL(self, host, port, contextFactory, timeout=30, bindAddress=None): (source)

Connect to an SSL server.

The parameters are all the same as to IReactorSSL.connectSSL except that the factory parameter is omitted.

ReturnsA Deferred which fires with an instance of the protocol class passed to this ClientCreator's initializer or fails if the connection cannot be set up for some reason.
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.