Package twisted :: Package internet :: Module tcp :: Class Connection

[show private | hide private]
[frames | no frames]

## Class Connection

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

Known Subclasses:
  `Server`, `BaseClient`

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)`
| `__getstate__(self)` (inherited from `Ephemeral`)
| `__setstate__(self, state)` (inherited from `Ephemeral`)
| ``connectionLost`(self, reason)` See abstract.FileDescriptor.connectionLost().
| ``doRead`(self)` Calls self.protocol.dataReceived with all available data.
| ``doWrite`(self)` Called when data is available for writing. (inherited from `FileDescriptor`)
| ``fileno`(self)` File Descriptor number for select(). (inherited from `FileDescriptor`)
| `getTcpNoDelay(self)`
| `log(self, bytes)` (inherited from `Logger`)
| ``logPrefix`(self)` Return the prefix to log with when I own the logging thread.
| ``loseConnection`(self)` Close the connection at the next available opportunity. (inherited from `FileDescriptor`)
| `pauseProducing(self)` (inherited from `FileDescriptor`)
| ``registerProducer`(self, producer, streaming)` Register to receive data from a producer. (inherited from `FileDescriptor`)
| `resumeProducing(self)` (inherited from `FileDescriptor`)
| `setTcpNoDelay(self, enabled)`
| ``startReading`(self)` Start waiting for read availability. (inherited from `FileDescriptor`)
| ``startWriting`(self)` Start waiting for write availability. (inherited from `FileDescriptor`)
| ``stopConsuming`(self)` Stop consuming data. (inherited from `FileDescriptor`)
| `stopProducing(self)` (inherited from `FileDescriptor`)
| ``stopReading`(self)` Stop waiting for read availability. (inherited from `FileDescriptor`)
| ``stopWriting`(self)` Stop waiting for write availability. (inherited from `FileDescriptor`)
| ``unregisterProducer`(self)` Stop consuming data from a producer, without disconnecting. (inherited from `FileDescriptor`)
| ``write`(self, data)` Reliably write some data. (inherited from `FileDescriptor`)
| `writeSequence(self, iovec)` (inherited from `FileDescriptor`)
| ``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)
| ``_closeSocket`(self)` Called to close our socket.
| `_Logger__prefix(self)` (inherited from `Logger`)
| ``_postLoseConnection`(self)` Called after a loseConnection(), when all data has been written. (inherited from `FileDescriptor`)

Class Variable Summary
`tuple` | `__implements__`
`string` | `logstr`

Method Details

### connectionLost(self, reason)

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

### logPrefix(self)

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

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

### _closeSocket(self)

Called to close our socket.

Class Variable Details

### __implements__

  Type:
    `tuple`
  Value:

        ((<class twisted.internet.interfaces.IProducer at 0x81d489c>,
          <class twisted.internet.interfaces.IReadWriteDescriptor at 0x81d45dc\
        >,
          <class twisted.internet.interfaces.IConsumer at 0x81d4704>,
          <class twisted.internet.interfaces.ITransport at 0x81d4bcc>),
         <class twisted.internet.interfaces.ITCPTransport at 0x81d4dd4>)

### logstr

  Type:
    `string`
  Value:

        'Uninitialized'

Generated by Epydoc 1.1 on Sat Feb 15 21:19:06 2003 | http://epydoc.sf.net