Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`internet`.`tcp``

module documentation
(source)

Various asynchronous TCP/IP classes.

End users shouldn't use this module directly - use the reactor APIs instead.

Class | `BaseClient` | A base class for client TCP (and similar) sockets.
Class | `Client` | A transport for a TCP protocol; either TCPv4 or TCPv6.
Class | `Connection` | Superclass of all socket-based FileDescriptors.
Class | `Connector` | A `Connector` provides of `twisted.internet.interfaces.IConnector` for all POSIX-style reactors.
Class | `Port` | A TCP server port, listening for connections.
Class | `Server` | Serverside socket-stream connection class.
Constant | `ENFILE` | Undocumented
Constant | `ENOMEM` | Undocumented
Constant | `EPERM` | Undocumented
Interface | `_IFileDescriptorReservation` | An open file that represents an emergency reservation in the process' file descriptor table. If `Port` encounters `EMFILE` on `accept(2)`, it can close this file descriptor, retry the `accept` so that the incoming connection occupies this file descriptor's space, and then close that connection and reopen this one.
Class | `_AbortingMixin` | Common implementation of `abortConnection`.
Class | `_BaseBaseClient` | Code shared with other (non-POSIX) reactors for management of general outgoing connections.
Class | `_BaseTCPClient` | Code shared with other (non-POSIX) reactors for management of outgoing TCP connections (both TCPv4 and TCPv6).
Class | `_BuffersLogs` | A context manager that buffers any log events until after its block exits.
Class | `_FileDescriptorReservation` | `_IFileDescriptorReservation` implementation.
Class | `_HasClose` | Undocumented
Class | `_NullFileDescriptorReservation` | A null implementation of `_IFileDescriptorReservation`.
Class | `_SocketCloser` | No summary
Function | `_accept` | Return a generator that yields client sockets from the provided listening socket until there are none left or an unrecoverable error occurs.
Function | `_getpeername` | See `_getrealname`.
Function | `_getrealname` | Return a 2-tuple of socket IP and port for IPv4 and a 4-tuple of socket IP, port, flowInfo, and scopeID for IPv6. For IPv6, it returns the interface portion (the part after the %) as a part of the IPv6 address, which Python 3...
Function | `_getsockname` | See `_getrealname`.
Function | `_resolveIPv6` | Resolve an IPv6 literal into an IPv6 address.
Constant | `_ACCEPT_ERRORS` | Undocumented
Constant | `_AI_NUMERICSERV` | Undocumented
Constant | `_NUMERIC_ONLY` | Undocumented
Variable | `_reservedFD` | Undocumented

ENFILE = (source)

Undocumented

Value

    object()

ENOMEM = (source)

Undocumented

Value

    object()

EPERM = (source)

Undocumented

Value

    object()

def _accept(logger, accepts, listener, reservedFD): (source)

Return a generator that yields client sockets from the provided listening socket until there are none left or an unrecoverable error occurs.

Parameters
logger:`Logger` | A logger to which `accept`-related events will be logged. This should not log to arbitrary observers that might open a file descriptor to avoid claiming the `EMFILE` file descriptor on UNIX-like systems.
accepts:An iterable. | An iterable iterated over to limit the number consecutive `accept`s.
listener:`socket.socket` | The listening socket.
reservedFD:`_IFileDescriptorReservation` | A reserved file descriptor that can be used to recover from `EMFILE` on UNIX-like systems.
Returns
A generator that yields `(socket, addr)` tuples from `socket.socket.accept`

def _getpeername(skt): (source)

See `_getrealname`.

def _getrealname(addr): (source)

Return a 2-tuple of socket IP and port for IPv4 and a 4-tuple of socket IP, port, flowInfo, and scopeID for IPv6. For IPv6, it returns the interface portion (the part after the %) as a part of the IPv6 address, which Python 3.7+ does not include.

Parameters
addr | A 2-tuple for IPv4 information or a 4-tuple for IPv6 information.

def _getsockname(skt): (source)

See `_getrealname`.

def _resolveIPv6(ip, port): (source)

Resolve an IPv6 literal into an IPv6 address.

This is necessary to resolve any embedded scope identifiers to the relevant `sin6_scope_id` for use with `socket.connect()`, `socket.listen()`, or `socket.bind()`; see RFC 3493 for more information.

Parameters
ip:`str` | An IPv6 address literal.
port:`int` | A port number.
Returns
a 4-tuple of `(host, port, flow, scope)`, suitable for use as an IPv6 address.
Raises
`socket.gaierror` | if either the IP or port is not numeric as it should be.

_ACCEPT_ERRORS = (source)

Undocumented

Value

    (EMFILE, ENOBUFS, ENFILE, ENOMEM, ECONNABORTED)

_AI_NUMERICSERV = (source)

Undocumented

Value

    getattr(socket, 'AI_NUMERICSERV', 0)

_NUMERIC_ONLY = (source)

Undocumented

Value

    socket.AI_NUMERICHOST|_AI_NUMERICSERV

_reservedFD = (source)

Undocumented