class FileHandle(_ConsumerMixin, _LogOwner): (source)
Known subclasses: twisted.internet.iocpreactor.tcp.Connection
, twisted.internet.iocpreactor.udp.Port
Constructor: FileHandle(reactor)
Implements interfaces: twisted.internet.interfaces.IConsumer
, twisted.internet.interfaces.IHalfCloseableDescriptor
, twisted.internet.interfaces.IPushProducer
, twisted.internet.interfaces.ITransport
File handle that can read and write asynchronously
Method | __init__ |
Undocumented |
Method | connection |
The connection was lost. |
Method | data |
Undocumented |
Method | do |
Undocumented |
Method | do |
Undocumented |
Method | get |
Undocumented |
Method | get |
Similar to getPeer, but returns an address describing this side of the connection. |
Method | get |
Get the remote address of this connection. |
Method | lose |
Close the connection at the next available opportunity. |
Method | lose |
Undocumented |
Method | pause |
Pause producing data. |
Method | read |
Indicates read connection was lost. |
Method | read |
Undocumented |
Method | resume |
Resume producing data. |
Method | start |
Undocumented |
Method | start |
Override in a subclass to cause the reactor to monitor this selectable for write events. This will be called once in unregisterProducer if loseConnection has previously been called, so that the connection can actually close. |
Method | stop |
Stop consuming data. |
Method | stop |
Stop producing data. |
Method | stop |
Undocumented |
Method | stop |
Undocumented |
Method | write |
Reliably write some data. |
Method | write |
Indicates write connection was lost. |
Method | write |
Write an iterable of byte strings to the physical connection. |
Method | write |
Undocumented |
Constant | SEND |
Undocumented |
Class Variable | disconnecting |
Undocumented |
Class Variable | dynamic |
Undocumented |
Class Variable | logstr |
Undocumented |
Class Variable | max |
Undocumented |
Class Variable | read |
Undocumented |
Class Variable | write |
Undocumented |
Instance Variable | connected |
Undocumented |
Instance Variable | data |
Undocumented |
Instance Variable | disconnected |
Undocumented |
Instance Variable | offset |
Undocumented |
Instance Variable | producer |
Undocumented |
Instance Variable | producer |
Undocumented |
Instance Variable | reactor |
Undocumented |
Instance Variable | reading |
Undocumented |
Instance Variable | writing |
Undocumented |
Method | _cb |
Undocumented |
Method | _cb |
Undocumented |
Method | _close |
Undocumented |
Method | _dispatch |
Dispatch previously read data. Return True if self.reading and we don't have any more data |
Method | _handle |
Returns False if we should stop reading for now |
Method | _handle |
Returns false if we should stop writing for now |
Method | _resume |
Undocumented |
Method | _resume |
Undocumented |
Class Variable | _write |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _temp |
Undocumented |
Instance Variable | _temp |
Undocumented |
Instance Variable | _write |
Undocumented |
Instance Variable | _write |
Undocumented |
Inherited from _ConsumerMixin
:
Method | register |
Register to receive data from a producer. |
Method | unregister |
Stop consuming data from a producer, without disconnecting. |
Instance Variable | streaming |
bool or int |
Inherited from _LogOwner
(via _ConsumerMixin
):
Method | log |
Override this method to insert custom logging behavior. Its return value will be inserted in front of every line. It may be called more times than the number of output lines. |
Method | _get |
Determine the log prefix to use for messages related to applicationObject, which may or may not be an interfaces.ILoggingContext provider. |
The connection was lost.
This is called when the connection on a selectable object has been lost. It will be called whether the connection was closed explicitly, an exception occurred in an event handler, or the other end of the connection closed it first.
Clean up state here, but make sure to call back up to FileDescriptor.
Similar to getPeer, but returns an address describing this side of the connection.
Returns | |
An IAddress provider. |
twisted.internet.iocpreactor.tcp.Connection
Get the remote address of this connection.
Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc.
Returns | |
An IAddress provider. |
Close the connection at the next available opportunity.
Call this to cause this FileDescriptor to lose its connection. It will first write any data that it has buffered.
If there is data buffered yet to be written, this method will cause the transport to lose its connection as soon as it's done flushing its write buffer. If you have a producer registered, the connection won't be closed until the producer is finished. Therefore, make sure you unregister your producer when it's finished, or the connection will never close.
Pause producing data.
Tells a producer that it has produced too much data to process for the time being, and to stop until resumeProducing() is called.
Resume producing data.
This tells a producer to re-add itself to the main loop and produce more data for its consumer.
Override in a subclass to cause the reactor to monitor this selectable for write events. This will be called once in unregisterProducer if loseConnection has previously been called, so that the connection can actually close.
Stop consuming data.
This is called when a producer has lost its connection, to tell the consumer to go lose its connection (and break potential circular references).
Stop producing data.
This tells a producer that its consumer has died, so it must stop producing data for good.
Write an iterable of byte strings to the physical connection.
If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single byte string.
Parameters | |
iovec | Undocumented |
data | The data to write. |