interface documentation


Method connectTCP Connect a TCP client.
Method listenTCP Connects a given protocol factory to the given numeric TCP/IP port.
def connectTCP(host: str, port: int, factory: ClientFactory, timeout: float, bindAddress: Optional[Tuple[str, int]]) -> IConnector: (source)

Connect a TCP client.

host:strA hostname or an IPv4 or IPv6 address literal.
port:inta port number
factory:ClientFactorya twisted.internet.protocol.ClientFactory instance
timeout:floatnumber of seconds to wait before assuming the connection has failed.
bindAddress:Optional[Tuple[str, int]]a (host, port) tuple of local address to bind to, or None.
IConnectorAn object which provides IConnector. This connector will call various callbacks on the factory when a connection is made, failed, or lost - see ClientFactory docs for details.
def listenTCP(port: int, factory: ServerFactory, backlog: int, interface: str) -> IListeningPort: (source)

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

port:inta port number on which to listen
factory:ServerFactorya twisted.internet.protocol.ServerFactory instance
backlog:intsize of the listen queue
interface:strThe local IPv4 or IPv6 address to which to bind; defaults to '', ie all IPv4 addresses. To bind to all IPv4 and IPv6 addresses, you must call this method twice.
IListeningPortan object that provides IListeningPort.
CannotListenErroras defined here twisted.internet.error.CannotListenError, if it cannot listen on this port (e.g., it cannot bind to the required port number)