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

Class Server

                     object --+    
                              |    
            _newtls.ServerMixin --+
                                  |
                 object --+       |
                          |       |
    _newtls.ConnectionMixin --+   |
                              |   |
             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 _newtls.ConnectionMixin: __providedBy__, loseConnection, registerProducer, startTLS, unregisterProducer, write, writeSequence

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

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

Inherited from abstract._LogOwner (private): _getLogPrefix

Inherited from _SocketCloser (private): _closeSocket

Inherited from _AbortingMixin: abortConnection

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

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 abstract.FileDescriptor: SEND_LIMIT, bufferSize, connected, dataBuffer, disconnected, disconnecting, offset

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

Inherited from _SocketCloser (private): _socketShutdownMethod

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 _newtls.ServerMixin (private): _tlsClientDefault

Inherited from Connection: logstr

Inherited from _newtls.ConnectionMixin: TLS

Inherited from abstract._ConsumerMixin: producer, producerPaused, streamingProducer

Inherited from _AbortingMixin (private): _aborting

Properties [hide private]

Inherited from object: __class__

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.

Overrides: object.__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