Known subclasses: twisted.internet.iocpreactor.tcp.Connection, twisted.internet.iocpreactor.udp.Port

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 startReading Undocumented
Method stopReading Undocumented
Method doRead Undocumented
Method readFromHandle Undocumented
Method dataReceived Undocumented
Method readConnectionLost Indicates read connection was lost.
Method loseWriteConnection Undocumented
Method writeConnectionLost Indicates write connection was lost.
Method startWriting No summary
Method stopWriting Undocumented
Method doWrite Undocumented
Method writeToHandle Undocumented
Method write Reliably write some data.
Method writeSequence Write an iterable of byte strings to the physical connection.
Method __init__ Undocumented
Method connectionLost The connection was lost.
Method getFileHandle Undocumented
Method loseConnection Close the connection at the next available opportunity.
Method stopConsuming Stop consuming data.
Method resumeProducing Resume producing data.
Method pauseProducing Pause producing data.
Method stopProducing Stop producing data.
Method _resumeReading Undocumented
Method _dispatchData Dispatch previously read data. Return True if self.reading and we don't have any more data
Method _cbRead Undocumented
Method _handleRead Returns False if we should stop reading for now
Method _closeWriteConnection Undocumented
Method _resumeWriting Undocumented
Method _cbWrite Undocumented
Method _handleWrite Returns false if we should stop writing for now

Inherited from _ConsumerMixin:

Instance Variable producer None if no producer is registered, otherwise the registered producer.
Instance Variable producerPaused A flag indicating whether the producer is currently paused. (type: bool)
Instance Variable streamingProducer 0 A flag indicating whether the producer was registered as a streaming (ie push) producer or not (ie a pull producer). This will determine whether the consumer may ever need to pause and resume it, or if it can merely call resumeProducing on it when buffer space is available.
Instance Variable streamingProducer bool or int
Method registerProducer Register to receive data from a producer.
Method unregisterProducer Stop consuming data from a producer, without disconnecting.

Inherited from _LogOwner:

Method logPrefix 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 _getLogPrefix Determine the log prefix to use for messages related to applicationObject, which may or may not be an interfaces.ILoggingContext provider.
def startReading(self):
Undocumented
def stopReading(self):
Undocumented
def _resumeReading(self):
Undocumented
def _dispatchData(self):

Dispatch previously read data. Return True if self.reading and we don't have any more data

def _cbRead(self, rc, data, evt):
Undocumented
def _handleRead(self, rc, data, evt):

Returns False if we should stop reading for now

def doRead(self):
Undocumented
def readFromHandle(self, bufflist, evt):
Undocumented
def dataReceived(self, data):
Undocumented
def readConnectionLost(self, reason):
def loseWriteConnection(self):
Undocumented
def _closeWriteConnection(self):
Undocumented
def writeConnectionLost(self, reason):

Indicates write connection was lost.

def startWriting(self):

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.

def stopWriting(self):
Undocumented
def _resumeWriting(self):
Undocumented
def _cbWrite(self, rc, numBytesWritten, evt):
Undocumented
def _handleWrite(self, rc, numBytesWritten, evt):

Returns false if we should stop writing for now

def doWrite(self):
Undocumented
def writeToHandle(self, buff, evt):
Undocumented
def write(self, data):

Reliably write some data.

The data is buffered until his file descriptor is ready for writing.

def writeSequence(self, iovec):

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.

ParametersdataThe data to write. (type: an iterable of bytes)
def __init__(self, reactor=None):
def connectionLost(self, reason):

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.

def getFileHandle(self):
Undocumented
def loseConnection(self, _connDone=failure.Failure(main.CONNECTION_DONE)):

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.

def stopConsuming(self):

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).

def resumeProducing(self):

Resume producing data.

This tells a producer to re-add itself to the main loop and produce more data for its consumer.

def pauseProducing(self):

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.

def stopProducing(self):

Stop producing data.

This tells a producer that its consumer has died, so it must stop producing data for good.

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.