interface documentation
class IReactorTCP2(IReactorTCP): (source)
Undocumented
| Method | connect |
Connect a TCP client. |
| Method | listen |
Connects a given protocol factory to the given numeric TCP/IP port. |
def connectTCP(host:
str, port: int, factory: ClientFactory[ P], timeout: float = 30.0, bindAddress: _Binding | tuple[ str, int] | None = None) -> IConnector:
(source)
¶
Connect a TCP client.
| Parameters | |
host:str | A hostname or an IPv4 or IPv6 address literal. |
port:int | a port number |
factory:ClientFactory[ | a twisted.internet.protocol.ClientFactory instance |
timeout:float | number of seconds to wait before assuming the connection has failed. |
bind_Binding | tuple[ | configuration saying how to bind the address, an object returned from twisted.internet.tcp.makeBinding |
| Returns | |
IConnector | An 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:
_Binding | int, factory: ServerFactory, backlog: int = 50, interface: str | None = None) -> IListeningPort:
(source)
¶
Connects a given protocol factory to the given numeric TCP/IP port.
| Parameters | |
port:_Binding | int | object returned by twisted.internet.tcp.makeBinding describing which address, port and options to use when binding |
factory:ServerFactory | a twisted.internet.protocol.ServerFactory instance |
backlog:int | size of the listen queue |
interface:str | None | Unused. Note that to bind to all IPv4 and IPv6 addresses, you must call this method twice. |
| Returns | |
IListeningPort | an object that provides IListeningPort. |
| 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) |