# ``twisted`.`internet`.`iocpreactor`.`tcp`.`Port``

class documentation

`class Port(_SocketCloser, _LogOwner): (source)`

Implements interfaces: `twisted.internet.interfaces.IListeningPort`

View In Hierarchy

Undocumented

Method | `__init__` | Undocumented
Method | `__repr__` | Undocumented
Method | `cbAccept` | Undocumented
Method | `connectionLost` | Cleans up the socket.
Method | `doAccept` | Undocumented
Method | `getHost` | Returns an IPv4Address or IPv6Address.
Method | `handleAccept` | Undocumented
Method | `logPrefix` | Returns the name of my class, to prefix log entries with.
Method | `loseConnection` | Stop accepting connections on this port.
Method | `startListening` | Start listening on this port.
Instance Variable | `addressFamily` | Undocumented
Instance Variable | `addrLen` | Undocumented
Instance Variable | `backlog` | Undocumented
Instance Variable | `connected` | Undocumented
Instance Variable | `deferred` | Undocumented
Instance Variable | `disconnected` | Undocumented
Instance Variable | `disconnecting` | Undocumented
Instance Variable | `factory` | Undocumented
Instance Variable | `getFileHandle` | Undocumented
Instance Variable | `interface` | Undocumented
Instance Variable | `port` | Undocumented
Instance Variable | `reactor` | Undocumented
Instance Variable | `sessionno` | Undocumented
Instance Variable | `socket` | Undocumented
Method | `_logConnectionLostMsg` | Log message for closing port
Class Variable | `_type` | Undocumented
Instance Variable | `_addressType` | Undocumented
Instance Variable | `_realPortNumber` | Undocumented

Inherited from `_SocketCloser`:

Method | `_closeSocket` | Undocumented
Instance Variable | `_shouldShutdown` | Set to `True` if `shutdown` should be called before calling `close` on the underlying socket.

Inherited from `_LogOwner`:

Method | `_getLogPrefix` | Determine the log prefix to use for messages related to `applicationObject`, which may or may not be an `interfaces.ILoggingContext` provider.

def __init__(self, port, factory, backlog=50, interface='', reactor=None): (source)

Undocumented

def __repr__(self): (source)

Undocumented

Returns
`str` | Undocumented

def cbAccept(self, rc, data, evt): (source)

Undocumented

def connectionLost(self, reason): (source)
Cleans up the socket.
def doAccept(self): (source)

Undocumented

def getHost(self): (source)
from `twisted.internet.interfaces.IListeningPort`

Returns an IPv4Address or IPv6Address.

This indicates the server's address.

def handleAccept(self, rc, evt): (source)

Undocumented

def logPrefix(self): (source)
from `twisted.internet.interfaces.ILoggingContext`
overrides `twisted.internet.abstract._LogOwner.logPrefix`
Returns the name of my class, to prefix log entries with.
def loseConnection(self, connDone=failure.Failure(main.CONNECTION_DONE)): (source)

Stop accepting connections on this port.

This will shut down my socket and call self.connectionLost(). It returns a deferred which will fire successfully when the port is actually closed.

def startListening(self): (source)
from `twisted.internet.interfaces.IListeningPort`
Start listening on this port.

Raises
`CannotListenError` | If it cannot listen on this port (e.g., it is a TCP port and it cannot bind to the required port number).

addressFamily = (source)

Undocumented

addrLen = (source)

Undocumented

backlog = (source)

Undocumented

connected: `bool` = (source)

Undocumented

deferred = (source)

Undocumented

disconnected: `bool` = (source)

Undocumented

disconnecting: `bool` = (source)

Undocumented

factory = (source)

Undocumented

getFileHandle = (source)

Undocumented

interface = (source)

Undocumented

port = (source)

Undocumented

reactor = (source)

Undocumented

sessionno = (source)

Undocumented

socket = (source)

Undocumented

def _logConnectionLostMsg(self): (source)
Log message for closing port
_type: `str` = (source)

Undocumented

_addressType = (source)

Undocumented

_realPortNumber = (source)

Undocumented