twisted.internet.tcp.Connection

Package twisted :: Package internet :: Module tcp :: Class Connection |
[frames | no frames]

## Class Connection

     Ephemeral --+
                 |
        Logger --+
                 |
    FileDescriptor --+
                     |
                    Connection

Known Subclasses:
  `BaseClient`, `Server`

I am the superclass of all socket-based FileDescriptors.

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

Method Summary
| `__init__(self, skt, protocol, reactor)`
| ``_closeSocket`(self)` Called to close our socket.
| `_startTLS(self)`
| ``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.
| `setTcpKeepAlive(self, enabled)`
| `setTcpNoDelay(self, enabled)`
| `startTLS(self, ctx)`
| ``writeSomeData`(self, data)` Connection.writeSomeData(data) -> #of bytes written | CONNECTION_LOST This writes as much data as possible to the socket and returns either the number of bytes read (which is positive) or a connection error code (which is negative)
Inherited from FileDescriptor
| ``_postLoseConnection`(self)` Called after a loseConnection(), when all data has been written.
| ``doWrite`(self)` Called when data is available for writing.
| ``fileno`(self)` File Descriptor number for select().
| ``loseConnection`(self)` Close the connection at the next available opportunity.
| ``pauseProducing`(self)`
| ``registerProducer`(self, producer, streaming)` Register to receive data from a producer.
| ``resumeProducing`(self)`
| ``startReading`(self)` Start waiting for read availability.
| ``startWriting`(self)` Start waiting for write availability.
| ``stopConsuming`(self)` Stop consuming data.
| ``stopProducing`(self)`
| ``stopReading`(self)` Stop waiting for read availability.
| ``stopWriting`(self)` Stop waiting for write availability.
| ``unregisterProducer`(self)` Stop consuming data from a producer, without disconnecting.
| ``write`(self, data)` Reliably write some data.
| ``writeSequence`(self, iovec)`
Inherited from Ephemeral
| ``__getstate__`(self)`
| ``__setstate__`(self, state)`

Class Variable Summary
`tuple` | `__implements__` = `((<class twisted.internet.interfaces.IP...`
`str` | `logstr` = `'Uninitialized'`
`int` | `TLS` = 0
Inherited from FileDescriptor
`int` | `bufferSize` = 65536
`int` | `connected` = 0
`str` | `dataBuffer` = `''`
`int` | `disconnected` = 0
`int` | `disconnecting` = 0
`int` | `offset` = 0
`NoneType` | `producer` = None
`int` | `producerPaused` = 0
`int` | `streamingProducer` = 0

Method Details

### _closeSocket(self) Called to close our socket.

### connectionLost(self, reason) See abstract.FileDescriptor.connectionLost(). Overrides: `twisted.internet.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.

### getHandle(self) Return the socket for this connection.

### logPrefix(self) Return the prefix to log with when I own the logging thread. Overrides: `twisted.python.log.Logger.logPrefix`

### writeSomeData(self, data) Connection.writeSomeData(data) -> #of bytes written | CONNECTION_LOST This writes as much data as possible to the socket and returns either the number of bytes read (which is positive) or a connection error code (which is negative) Overrides: `twisted.internet.abstract.FileDescriptor.writeSomeData`

Class Variable Details

    ### __implements__ Type: `tuple` Value:
        ((<class twisted.internet.interfaces.IProducer at 0x827b064>,
          <class twisted.internet.interfaces.IReadWriteDescriptor at 0x827d20c\
        >,
          <class twisted.internet.interfaces.IConsumer at 0x824feb4>,
          <class twisted.internet.interfaces.ITransport at 0x8254024>),
         <class twisted.internet.interfaces.ITCPTransport at 0x8241624>,
         <class twisted.internet.interfaces.ISystemHandle at 0x827cf14>,
         <class twisted.internet.interfaces.ITLSTransport at 0x8241654>)

    ### logstr Type: `str` Value:
        'Uninitialized'

    ### TLS Type: `int` Value:
        0

Generated by Epydoc 2.0 on Sat May 15 20:08:36 2004 | http://epydoc.sf.net