Package twisted :: Package spread :: Module pb :: Class PBClientFactory

[frames | no frames]

## Class PBClientFactory

      Factory --+
                |
    ClientFactory --+
                    |
                   PBClientFactory

Client factory for PB brokers.

As with all client factories, use with reactor.connectTCP/SSL/etc.. getPerspective and getRootObject can be called either before or after the connect.

Method Summary
| `__init__(self)`
| `_cbAuthIdentity(self, authServRef, username, password)`
| `_cbGetPerspective(self, identityWrapper, serviceName, perspectiveName, client)`
| `_cbRespondToChallenge(self, (challenge, challenger), password)`
| `_cbResponse(self, (challenge, challenger), password, client)`
| `_cbSendUsername(self, root, username, password, client)`
| `_failAll(self, reason)`
| `_reset(self)`
| ``clientConnectionFailed`(self, connector, reason)` Called when a connection has failed to connect.
| ``clientConnectionLost`(self, connector, reason, reconnecting)` Reconnecting subclasses should call with reconnecting=1.
| `clientConnectionMade(self, broker)`
| ``disconnect`(self)` If the factory is connected, close the connection.
| ``getPerspective`(self, username, password, serviceName, perspectiveName, client)` Get perspective from remote PB server.
| ``getRootObject`(self)` Get root object of remote PB server.
| ``login`(self, credentials, client)` Login and get perspective from remote PB server.
Inherited from ClientFactory
| ``startedConnecting`(self, connector)` Called when a connection has been started.
Inherited from Factory
| ``buildProtocol`(self, addr)` Create an instance of a subclass of Protocol.
| ``doStart`(self)` Make sure startFactory is called.
| ``doStop`(self)` Make sure stopFactory is called.
| ``startFactory`(self)` This will be called before I begin listening on a Port or Connector.
| ``stopFactory`(self)` This will be called before I stop listening on all Ports/Connectors.

Class Variable Summary
`class` | `protocol` = `twisted.spread.pb.Broker`
`int` | `unsafeTracebacks` = 0
Inherited from Factory
`tuple` | `__implements__` = `(<class twisted.internet.interfaces.IPr...`
`str` | `noisy` = `'sure, why not'`
`int` | `numPorts` = 0

Method Details

### clientConnectionFailed(self, connector, reason)

Called when a connection has failed to connect.

It may be useful to call connector.connect() - this will reconnect.

  Parameters:
    `reason`
    (type=`twisted.python.failure.Failure`)
  Overrides:
    `twisted.internet.protocol.ClientFactory.clientConnectionFailed` (inherited documentation)

### clientConnectionLost(self, connector, reason, reconnecting=0)

Reconnecting subclasses should call with reconnecting=1.

  Overrides:
    `twisted.internet.protocol.ClientFactory.clientConnectionLost`

### disconnect(self)

If the factory is connected, close the connection.

Note that if you set up the factory to reconnect, you will need to implement extra logic to prevent automatic reconnection after this is called.

### getPerspective(self, username, password, serviceName, perspectiveName=None, client=None)

Get perspective from remote PB server.

New systems should use login() instead.

@return Deferred of RemoteReference to the perspective.

### getRootObject(self)

Get root object of remote PB server.

@return Deferred of the root object.

### login(self, credentials, client=None)

Login and get perspective from remote PB server.

Currently only credentials implementing IUsernamePassword are supported.

@return Deferred of RemoteReference to the perspective.

Class Variable Details

### unsafeTracebacks

  Type:
    `int`
  Value:

        0

Generated by Epydoc 2.0 on Sat May 15 20:07:59 2004 | http://epydoc.sf.net