class ClientCreator: (source)
Constructor: ClientCreator(reactor, protocolClass, *args, **kwargs)
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 |
Method | connect |
Connect to an SSL server. |
Method | connect |
Connect to a TCP server. |
Method | connect |
Connect to a Unix socket. |
Instance Variable | args |
Undocumented |
Instance Variable | kwargs |
Undocumented |
Instance Variable | protocol |
Undocumented |
Instance Variable | reactor |
Undocumented |
Method | _connect |
Initiate a connection attempt. |
Connect to an SSL server.
The parameters are all the same as to IReactorSSL.connectSSL
except that the factory parameter is omitted.
Returns | |
A 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. |
Connect to a TCP server.
The parameters are all the same as to IReactorTCP.connectTCP
except that the factory parameter is omitted.
Returns | |
A 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. |
Connect to a Unix socket.
The parameters are all the same as to IReactorUNIX.connectUNIX
except that the factory parameter is omitted.
Returns | |
A 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. |
Initiate a connection attempt.
Parameters | |
method | A callable which will actually start the connection attempt. For example, reactor.connectTCP. |
*args | Positional arguments to pass to method, excluding the factory. |
**kwargs | Keyword arguments to pass to method. |
Returns | |
A 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. |