class Connection(abstract.FileHandle, _SocketCloser, _AbortingMixin): (source)
Known subclasses: twisted.internet.iocpreactor.tcp.Client
, twisted.internet.iocpreactor.tcp.Server
Constructor: Connection(sock, proto, reactor)
Implements interfaces: twisted.internet.interfaces.ISystemHandle
, twisted.internet.interfaces.ITCPTransport
, twisted.internet.interfaces.ITLSTransport
, twisted.internet.iocpreactor.interfaces.IReadWriteHandle
Method | __init__ |
Undocumented |
Method | connection |
The connection was lost. |
Method | data |
No summary |
Method | get |
Return a system- and reactor-specific handle. |
Method | get |
Returns IPv4Address or IPv6Address . |
Method | get |
Returns IPv4Address or IPv6Address . |
Method | get |
Return if SO_KEEPALIVE is enabled. |
Method | get |
Return if TCP_NODELAY is enabled. |
Method | log |
Return the prefix to log with when I own the logging thread. |
Method | lose |
Close the underlying handle or, if TLS has been started, first shut it down. |
Method | read |
Indicates read connection was lost. |
Method | read |
Read into the given buffers from this handle. |
Method | register |
Register a producer. |
Method | set |
Enable/disable SO_KEEPALIVE. |
Method | set |
Enable/disable TCP_NODELAY. |
Method | start |
No summary |
Method | unregister |
Unregister a producer. |
Method | write |
Write some data, either directly to the underlying handle or, if TLS has been started, to the TLSMemoryBIOProtocol for it to encrypt and send. |
Method | write |
Write some data, either directly to the underlying handle or, if TLS has been started, to the TLSMemoryBIOProtocol for it to encrypt and send. |
Method | write |
Send buff to current file handle using _iocp.send. The buffer sent is limited to a size of self.SEND_LIMIT. |
Constant | TLS |
False to indicate the connection is in normal TCP mode, True to indicate that TLS has been started and that operations must be routed through the TLSMemoryBIOProtocol instance. |
Instance Variable | protocol |
Undocumented |
Instance Variable | socket |
Undocumented |
Method | _close |
Undocumented |
Inherited from FileHandle
:
Method | do |
Undocumented |
Method | do |
Undocumented |
Method | get |
Undocumented |
Method | lose |
Undocumented |
Method | pause |
Pause producing data. |
Method | resume |
Resume producing data. |
Method | start |
Undocumented |
Method | start |
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. |
Method | stop |
Stop consuming data. |
Method | stop |
Stop producing data. |
Method | stop |
Undocumented |
Method | stop |
Undocumented |
Method | write |
Indicates write connection was lost. |
Constant | SEND |
Undocumented |
Class Variable | disconnecting |
Undocumented |
Class Variable | dynamic |
Undocumented |
Class Variable | logstr |
Undocumented |
Class Variable | max |
Undocumented |
Class Variable | read |
Undocumented |
Class Variable | write |
Undocumented |
Instance Variable | connected |
Undocumented |
Instance Variable | data |
Undocumented |
Instance Variable | disconnected |
Undocumented |
Instance Variable | offset |
Undocumented |
Instance Variable | producer |
Undocumented |
Instance Variable | producer |
Undocumented |
Instance Variable | reactor |
Undocumented |
Instance Variable | reading |
Undocumented |
Instance Variable | writing |
Undocumented |
Method | _cb |
Undocumented |
Method | _cb |
Undocumented |
Method | _dispatch |
Dispatch previously read data. Return True if self.reading and we don't have any more data |
Method | _handle |
Returns False if we should stop reading for now |
Method | _handle |
Returns false if we should stop writing for now |
Method | _resume |
Undocumented |
Method | _resume |
Undocumented |
Class Variable | _write |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _temp |
Undocumented |
Instance Variable | _temp |
Undocumented |
Instance Variable | _write |
Undocumented |
Instance Variable | _write |
Undocumented |
Inherited from _ConsumerMixin
(via FileHandle
):
Instance Variable | streaming |
bool or int |
Inherited from _LogOwner
(via FileHandle
, _ConsumerMixin
):
Method | _get |
Determine the log prefix to use for messages related to applicationObject, which may or may not be an interfaces.ILoggingContext provider. |
Inherited from _SocketCloser
(via FileHandle
, _ConsumerMixin
, _LogOwner
):
Method | _close |
Undocumented |
Instance Variable | _should |
Set to True if shutdown should be called before calling close on the underlying socket. |
Inherited from _AbortingMixin
(via FileHandle
, _ConsumerMixin
, _LogOwner
, _SocketCloser
):
Method | abort |
Aborts the connection immediately, dropping any buffered data. |
Instance Variable | _aborting |
Set to True when abortConnection is called. |
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.
Return a system- and reactor-specific handle.
This might be a socket.socket() object, or some other type of object, depending on which reactor is being used. Use and manipulate at your own risk.
This might be used in cases where you want to set specific options not exposed by the Twisted APIs.
Close the underlying handle or, if TLS has been started, first shut it down.
See Also | |
twisted.internet.interfaces.ITransport.loseConnection |
Read into the given buffers from this handle.
Parameters | |
bufflist:list of objects implementing the read/write buffer protocol | the buffers to read into |
evt | an IOCP Event object |
Returns | |
tuple (return code, number of bytes read) |
Enable/disable SO_KEEPALIVE.
Enabling SO_KEEPALIVE sends packets periodically when the connection is otherwise idle, usually once every two hours. They are intended to allow detection of lost peers in a non-infinite amount of time.
Enable/disable TCP_NODELAY.
Enabling TCP_NODELAY turns off Nagle's algorithm. Small packets are sent sooner, possibly at the expense of overall throughput.
Write some data, either directly to the underlying handle or, if TLS has been started, to the TLSMemoryBIOProtocol
for it to encrypt and send.
See Also | |
twisted.internet.interfaces.ITransport.write |
Write some data, either directly to the underlying handle or, if TLS has been started, to the TLSMemoryBIOProtocol
for it to encrypt and send.
See Also | |
twisted.internet.interfaces.ITransport.writeSequence |
Send buff to current file handle using _iocp.send. The buffer sent is limited to a size of self.SEND_LIMIT.
False to indicate the connection is in normal TCP mode, True to indicate that TLS has been started and that operations must be routed through the TLSMemoryBIOProtocol
instance.
Value |
|