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)`
| ``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`)
| `startTLS(self, ctx)`
| ``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.
| ``_postLoseConnection`(self)` Called after a loseConnection(), when all data has been written. (inherited from `FileDescriptor`)
| `_startTLS(self)`

Class Variable Summary
`tuple` | `__implements__`
`str` | `logstr`
`int` | `TLS`

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'>,
          <class 'twisted.internet.interfaces.IReadWriteDescriptor'>,
          <class 'twisted.internet.interfaces.IConsumer'>,
          <class 'twisted.internet.interfaces.ITransport'>),
         <class 'twisted.internet.interfaces.ITCPTransport'>)

### logstr

  Type:
    `str`
  Value:

        'Uninitialized'

### TLS

  Type:
    `int`
  Value:

        0

Generated by Epydoc 1.1 on Thu May 8 13:18:29 2003 | http://epydoc.sf.net