twisted :: internet :: tcp :: Connection :: Class Connection
[hide private]

type Connection

                 object --+    
                          |    
    _newtls.ConnectionMixin --+
                              |
             object --+       |
                      |       |
abstract._ConsumerMixin --+   |
                          |   |
             object --+   |   |
                      |   |   |
     abstract._LogOwner --+   |
                          |   |
    abstract.FileDescriptor --+
                              |
                 object --+   |
                          |   |
              _SocketCloser --+
                              |
                 object --+   |
                          |   |
             _AbortingMixin --+
                              |
                             Connection
Known Subclasses:

Superclass of all socket-based FileDescriptors.

This is an abstract superclass of all objects which represent a TCP/IP connection based socket.

Instance Methods [hide private]
 
__init__(self, skt, protocol, reactor=None)
 
__provides__(...)
Special descriptor for class __provides__
 
_closeWriteConnection(self)
 
_dataReceived(self, data)
 
connectionLost(self, reason)
See abstract.FileDescriptor.connectionLost().
 
doRead(self)
Calls self.protocol.dataReceived with all available data.
 
getHandle(self)
Return the socket for this connection.
 
getTcpKeepAlive(self)
 
getTcpNoDelay(self)
 
logPrefix(self)
Return the prefix to log with when I own the logging thread.
 
readConnectionLost(self, reason)
 
setTcpKeepAlive(self, enabled)
 
setTcpNoDelay(self, enabled)
 
writeSomeData(self, data)
Write as much as possible of the given data to this TCP connection.

Inherited from _newtls.ConnectionMixin: __providedBy__, loseConnection, registerProducer, startTLS, unregisterProducer, write, writeSequence

Inherited from abstract.FileDescriptor: doWrite, fileno, loseWriteConnection, pauseProducing, resumeProducing, startReading, startWriting, stopConsuming, stopProducing, stopReading, stopWriting, writeConnectionLost

Inherited from abstract.FileDescriptor (private): _isSendBufferFull, _maybePauseProducer, _postLoseConnection

Inherited from abstract._LogOwner (private): _getLogPrefix

Inherited from _SocketCloser (private): _closeSocket

Inherited from _AbortingMixin: abortConnection

Class Variables [hide private]
  __implemented__ = <implementedBy twisted.internet.tcp.Connection>

Inherited from abstract.FileDescriptor: SEND_LIMIT, bufferSize, connected, dataBuffer, disconnected, disconnecting, offset

Inherited from abstract.FileDescriptor (private): _writeDisconnected, _writeDisconnecting

Instance Variables [hide private]
str logstr = 'Uninitialized'
prefix used when logging events related to this connection.

Inherited from _newtls.ConnectionMixin: TLS

Inherited from abstract._ConsumerMixin: producer, producerPaused, streamingProducer

Inherited from _SocketCloser (private): _shouldShutdown

Inherited from _AbortingMixin (private): _aborting

Method Details [hide private]

__init__(self, skt, protocol, reactor=None)
(Constructor)

 
Parameters:
  • reactor - An IReactorFDSet provider which this descriptor will use to get readable and writeable event notifications. If no value is given, the global reactor will be used.
Overrides: abstract.FileDescriptor.__init__
(inherited documentation)

__provides__(...)

 
Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that
we can get declarations for objects without instance-specific
interfaces a bit quicker.

Overrides: _AbortingMixin.__provides__

_closeWriteConnection(self)

 
Overrides: abstract.FileDescriptor._closeWriteConnection

connectionLost(self, reason)

 

See abstract.FileDescriptor.connectionLost().

Overrides: abstract.FileDescriptor.connectionLost

doRead(self)

 

Calls self.protocol.dataReceived with all available data.

This reads up to self.bufferSize bytes of data from its socket, then calls self.dataReceived(data) to process it. If the connection is not lost through an error in the physical recv(), this function will return the result of the dataReceived call.

Overrides: abstract.FileDescriptor.doRead

logPrefix(self)

 

Return the prefix to log with when I own the logging thread.

Overrides: abstract._LogOwner.logPrefix

readConnectionLost(self, reason)

 
Overrides: abstract.FileDescriptor.readConnectionLost

writeSomeData(self, data)

 

Write as much as possible of the given data to this TCP connection.

This sends up to self.SEND_LIMIT bytes from data. If the connection is lost, an exception is returned. Otherwise, the number of bytes successfully written is returned.

Overrides: abstract.FileDescriptor.writeSomeData