Table of Contents

Class: Port | Twisted-0.17.4/twisted/internet/tcp.py
--- | ---

### I am a TCP server port, listening for connections.

When a connection is accepted, I will call my factory's buildProtocol with the incoming connection as an argument, according to the specification described in twisted.protocols.protocol.Factory.

If you wish to change the sort of transport that will be used, my `transport' attribute will be called with the signature expected for Server.__init__, so it can be replaced.

Base Classes |
--- | ---
abstract.FileDescriptor

Methods |
--- | ---

__getstate__ __init__ __repr__ connectionLost createInternetSocket doRead | doWrite getHost logPrefix loseConnection startListening

| __getstate__

    __getstate__ ( self )

(internal) get my state for persistence

| __init__

    __init__ (
            self,
            port,
            factory,
            backlog=5,
            interface='',
            )

Initialize with a numeric port to listen on.

| __repr__

    __repr__ ( self )

| connectionLost

    connectionLost ( self )

Cleans up my socket.

| createInternetSocket

    createInternetSocket ( self )

(internal) create an AF_INET socket.

| doRead

    doRead ( self )

### Called when my socket is ready for reading.

This accepts a connection and callse self.protocol() to handle the wire-level protocol.

| doWrite

    doWrite ( self )

Raises an AssertionError.

Exceptions |
--- | ---
RuntimeError, "doWrite called on a %s" % str( self.__class__ )

| getHost

    getHost ( self )

### Returns a tuple of (`INET`, hostname, port).

This indicates the servers address.

| logPrefix

    logPrefix ( self )

Returns the name of my class, to prefix log entries with.

| loseConnection

    loseConnection ( self )

### Stop accepting connections on this port.

This will shut down my socket and call self.connectionLost().

| startListening

    startListening ( self )

### Create and bind my socket, and begin listening on it.

This is called on unserialization, and must be called after creating a server to begin listening on the specified port.

Table of Contents

This document was automatically generated on Sat Apr 20 01:30:49 2002 by HappyDoc version 2.0