twisted.application.internet.ClientService(service.Service, object)
class documentationtwisted.application.internet
View Source
(View In Hierarchy)
A ClientService
maintains a single outgoing connection to a client endpoint, reconnecting
after a configurable timeout when a connection fails, either before or
after connecting.
Present Since | 16.1.0 |
Method | __init__ | |
Method | whenConnected | Retrieve the currently-connected Protocol ,
or the next one to connect. |
Method | startService | Start this ClientService ,
initiating the connection retry loop. |
Method | stopService | Stop attempting to reconnect and close any existing connections. |
Method | _unawait | Fire all outstanding ClientService.whenConnected
Deferred s. |
Inherited from Service:
Method | __getstate__ | Undocumented |
Method | setName | Set the name of the service. |
Method | setServiceParent | Set the parent of the service. This method is responsible for setting
the parent attribute on this service (the child service). |
Method | disownServiceParent | Use this API to remove an IService
from an IServiceCollection . |
Method | privilegedStartService | Do preparation work for starting the service. |
Parameters | endpoint | A stream
client endpoint provider which will be used to connect when the
service starts. |
factory | A protocol
factory which will be used to create clients for the endpoint. | |
retryPolicy | A policy configuring how long ClientService
will wait between attempts to connect to endpoint . (type: callable taking (the number of failed connection attempts made in a row (int ))
and returning the number of seconds to wait before making another attempt.) | |
clock | The clock used to schedule reconnection. It's mainly useful to be
parametrized in tests. If the factory is serialized, this attribute will
not be serialized, and the default value (the reactor) will be restored
when deserialized. (type: IReactorTime ) |
Retrieve the currently-connected Protocol
,
or the next one to connect.
Returns | a Deferred that fires with a protocol produced by the factory passed to
__init__ (type: Deferred
firing with IProtocol
or failing with CancelledError
the service is stopped.) |
Fire all outstanding ClientService.whenConnected
Deferred
s.
Parameters | value | the value to fire the Deferred s
with. |