Package twisted :: Package internet :: Module interfaces :: Class IReactorTCP

[frames | no frames]

## Class IReactorTCP

    Interface --+
                |
               IReactorTCP

Method Summary
| ``connectTCP`(self, host, port, factory, timeout, bindAddress)` Connect a TCP client.
| ``listenTCP`(self, port, factory, backlog, interface)` Connects a given protocol factory to the given numeric TCP/IP port.

Method Details

### connectTCP(self, host, port, factory, timeout=30, bindAddress=None)

Connect a TCP client.

  Parameters:
    `host` - a host name
    `port` - a port number
    `factory` - a `twisted.internet.protocol.ClientFactory` instance
    `timeout` - number of seconds to wait before assuming the connection has failed.
    `bindAddress` - a (host, port) tuple of local address to bind to, or None.
  Returns:
    An object implementing `IConnector`. This connector will call various callbacks on the factory when a connection is made, failed, or lost - see `ClientFactory` docs for details.

### listenTCP(self, port, factory, backlog=5, interface='')

Connects a given protocol factory to the given numeric TCP/IP port.

  Parameters:
    `port` - a port number on which to listen
    `factory` - a `twisted.internet.protocol.ServerFactory` instance
    `backlog` - size of the listen queue
    `interface` - the hostname to bind to, defaults to '' (all)
  Returns:
    an object that satisfies the IListeningPort interface
  Raises:
    `CannotListenError` - as defined here `twisted.internet.error.CannotListenError`, if it cannot listen on this port (e.g., it cannot bind to the required port number)

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