class _BaseBaseClient: (source)
Known subclasses: twisted.internet.iocpreactor.tcp.Client
, twisted.internet.tcp.BaseClient
Code shared with other (non-POSIX) reactors for management of general outgoing connections.
Requirements upon subclasses are documented as instance variables rather than abstract methods, in order to avoid MRO confusion, since this base is mixed in to unfortunately weird and distinctive multiple-inheritance hierarchies and many of these attributes are provided by peer classes rather than descendant classes in those hierarchies.
Method | connectionLost |
No summary |
Method | failIfNotConnected |
Generic method called when the attempts to connect failed. It basically cleans everything it can: call connectionFailed, stop read and write, delete socket related members. |
Method | resolveAddress |
No summary |
Method | stopConnecting |
If a connection attempt is still outstanding (i.e. no connection is yet established), immediately stop attempting to connect. |
Instance Variable | addressFamily |
The address family constant (socket.AF_INET, socket.AF_INET6, socket.AF_UNIX) of the underlying socket of this client connection. |
Instance Variable | reactor |
The class pointed to by _commonConnection should set this attribute in its constructor. |
Instance Variable | realAddress |
Undocumented |
Instance Variable | socketType |
The socket type constant (socket.SOCK_STREAM or socket.SOCK_DGRAM) of the underlying socket. |
Method | _finishInit |
Called by subclasses to continue to the stage of initialization where the socket connect attempt is made. |
Method | _setRealAddress |
Set the resolved address of this _BaseBaseClient and initiate the connection attempt. |
Class Variable | _commonConnection |
Subclasses must provide this attribute, which indicates the Connection -alike class to invoke __init__ and connectionLost on. |
Instance Variable | _closeSocket |
Subclasses must implement in order to close the socket in response to a terminated connection attempt. |
Instance Variable | _collectSocketDetails |
Clean up references to the attached socket in its underlying OS resource (such as a file descriptor or file handle), as part of post connection-failure cleanup. |
Instance Variable | _requiresResolution |
A flag indicating whether the address of this client will require name resolution. True if the hostname of said address indicates a name that must be resolved by hostname lookup, False if it indicates an IP address literal. |
Instance Variable | _stopReadingAndWriting |
Subclasses must implement in order to remove this transport from its reactor's notifications in response to a terminated connection attempt. |
Connector
that the connection attempt has failed, or inform the connected IProtocol
that the established connection has been lost.Parameters | |
reason:Failure | the reason that the connection was terminated |
_BaseBaseClient
, if necessary, and then move on to attempting the connection once an address has been determined. (The connection will be attempted immediately within this function if either name resolution can be synchronous or the address was an IP address literal.)Returns | |
None | |
Note | |
You don't want to call this method from outside, as it won't do anything useful; it's just part of the connection bootstrapping process. Also, although this method is on _BaseBaseClient for historical reasons, it's not used anywhere except for Client itself. |
twisted.internet.interfaces.IReactorTime
, twisted.internet.interfaces.IReactorCore
, twisted.internet.interfaces.IReactorFDSet
=
(source)
twisted.internet.iocpreactor.tcp.Client
Parameters | |
whenDone | A 0-argument callable to invoke once the connection is set up. This is None if the connection could not be prepared due to a previous error. |
skt:socket._socketobject | The socket object to use to perform the connection. |
error | The error to fail the connection with. |
reactor:twisted.internet.interfaces.IReactorTime | The reactor to use for this client. |
_BaseBaseClient
and initiate the connection attempt.Parameters | |
address | Depending on whether this is an IPv4 or IPv6 connection attempt, a 2-tuple of (host, port) or a 4-tuple of (host, port, flow, scope). At this point it is a fully resolved address, and the 'host' portion will always be an IP address, not a DNS name. |
Connection
-alike class to invoke __init__ and connectionLost on.