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

type Server

                     object --+    
                              |    
                _TLSServerMixin --+
                                  |
                 object --+       |
                          |       |
        _TLSConnectionMixin --+   |
                              |   |
             object --+       |   |
                      |       |   |
abstract._ConsumerMixin --+   |   |
                          |   |   |
             object --+   |   |   |
                      |   |   |   |
     abstract._LogOwner --+   |   |
                          |   |   |
    abstract.FileDescriptor --+   |
                              |   |
                 object --+   |   |
                          |   |   |
              _SocketCloser --+   |
                              |   |
                 object --+   |   |
                          |   |   |
             _AbortingMixin --+   |
                              |   |
                     Connection --+
                                  |
                                 Server
Known Subclasses:

Serverside socket-stream connection class.

This is a serverside network connection transport; a socket which came from an accept() on a server.

Nested Classes [hide private]
_addressType
An IPv4Address represents the address of an IPv4 socket endpoint.
Instance Methods [hide private]
 
__init__(sock, protocol, client, server, sessionno)
Initialize it with a socket, a protocol, a descriptor for my peer (a tuple of host, port describing the other end of the connection), an instance of Port, and a session number.
 
__repr__(self)
A string representation of this connection.
 
getHost(self)
Returns an IPv4Address or IPv6Address.
 
getPeer(self)
Returns an IPv4Address or IPv6Address.

Inherited from Connection: __provides__, connectionLost, doRead, getHandle, getTcpKeepAlive, getTcpNoDelay, logPrefix, readConnectionLost, setTcpKeepAlive, setTcpNoDelay, writeSomeData

Inherited from Connection (private): _closeWriteConnection, _dataReceived

Inherited from _TLSConnectionMixin: __providedBy__

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

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

Inherited from abstract._ConsumerMixin: registerProducer, unregisterProducer

Inherited from abstract._LogOwner (private): _getLogPrefix

Inherited from _SocketCloser (private): _closeSocket

Inherited from _AbortingMixin: abortConnection

Class Methods [hide private]
 
_fromConnectedSocket(cls, fileDescriptor, addressFamily, factory, reactor)
Create a new Server based on an existing connected SOCK_STREAM socket.
Class Variables [hide private]

Inherited from Connection: __implemented__

Inherited from _TLSConnectionMixin: TLS

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

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

Instance Variables [hide private]
_base
Connection, which is the base class of this class which has all of the useful file descriptor methods.

Inherited from Connection: logstr

Inherited from abstract._ConsumerMixin: producer, producerPaused, streamingProducer

Inherited from _SocketCloser (private): _shouldShutdown

Inherited from _AbortingMixin (private): _aborting

Method Details [hide private]

__init__(sock, protocol, client, server, sessionno)
(Constructor)

 

Initialize it with a socket, a protocol, a descriptor for my peer (a tuple of host, port describing the other end of the connection), an instance of Port, and a session number.

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__

__repr__(self)
(Representation operator)

 

A string representation of this connection.

Overrides: object.__repr__

_fromConnectedSocket(cls, fileDescriptor, addressFamily, factory, reactor)
Class Method

 

Create a new Server based on an existing connected SOCK_STREAM socket.

Arguments are the same as to Server.__init__, except where noted.

Parameters:
  • fileDescriptor - An integer file descriptor associated with a connected socket. The socket must be in non-blocking mode. Any additional attributes desired, such as FD_CLOEXEC, must also be set already.
  • addressFamily - The address family (sometimes called domain) of the existing socket. For example, socket.AF_INET.
Returns:
A new instance of cls wrapping the socket given by fileDescriptor.

getHost(self)

 

Returns an IPv4Address or IPv6Address.

This indicates the server's address.

getPeer(self)

 

Returns an IPv4Address or IPv6Address.

This indicates the client's address.


Instance Variable Details [hide private]

_base

Connection, which is the base class of this class which has all of the useful file descriptor methods. This is used by _TLSServerMixin to call the right methods to directly manipulate the transport, as is necessary for writing TLS-encrypted bytes (whereas those methods on Server will go through another layer of TLS if it has been enabled).
Value:
twisted.internet.tcp.Connection