| |
- BaseRequestHandler
-
- DatagramRequestHandler
- StreamRequestHandler
- ForkingMixIn
-
- ForkingTCPServer(ForkingMixIn, TCPServer)
- ForkingUDPServer(ForkingMixIn, UDPServer)
- TCPServer
-
- UDPServer
-
- UnixDatagramServer
- UnixStreamServer
- ThreadingMixIn
-
- ThreadingTCPServer(ThreadingMixIn, TCPServer)
- ThreadingUDPServer(ThreadingMixIn, UDPServer)
- ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer)
- ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer)
class BaseRequestHandler |
|
Base class for request handler classes.
This class is instantiated for each request to be handled. The
constructor sets the instance variables request, client_address
and server, and then calls the handle() method. To implement a
specific service, all you need to do is to derive a class which
defines a handle() method.
The handle() method can find the request as self.request, the
client address as self.client_address, and the server (in case it
needs access to per-server information) as self.server. Since a
separate instance is created for each request, the handle() method
can define arbitrary other instance variariables.
|
| |
- __del__(self)
- no doc string
- __init__(self, request, client_address, server)
- no doc string
- finish(self)
- no doc string
- handle(self)
- no doc string
- setup(self)
- no doc string
|
class TCPServer |
|
Base class for various socket-based server classes.
Defaults to synchronous IP stream (i.e., TCP).
Methods for the caller:
- __init__(server_address, RequestHandlerClass)
- serve_forever()
- handle_request() # if you don't use serve_forever()
- fileno() -> int # for select()
Methods that may be overridden:
- server_bind()
- server_activate()
- get_request() -> request, client_address
- verify_request(request, client_address)
- process_request(request, client_address)
- handle_error()
Methods for derived classes:
- finish_request(request, client_address)
Class variables that may be overridden by derived classes or
instances:
- address_family
- socket_type
- request_queue_size (only for stream sockets)
Instance variables:
- server_address
- RequestHandlerClass
- socket
|
| |
- __init__(self, server_address, RequestHandlerClass)
- Constructor. May be extended, do not override.
- fileno(self)
- Return socket file number.
- Interface required by select().
- finish_request(self, request, client_address)
- Finish one request by instantiating RequestHandlerClass.
- get_request(self)
- Get the request and client address from the socket.
- May be overridden.
- handle_error(self, request, client_address)
- Handle an error gracefully. May be overridden.
- The default is to print a traceback and continue.
- handle_request(self)
- Handle one request, possibly blocking.
- process_request(self, request, client_address)
- Call finish_request.
- Overridden by ForkingMixIn and ThreadingMixIn.
- serve_forever(self)
- Handle one request at a time until doomsday.
- server_activate(self)
- Called by constructor to activate the server.
- May be overridden.
- server_bind(self)
- Called by constructor to bind the socket.
- May be overridden.
- verify_request(self, request, client_address)
- Verify the request. May be overridden.
- Return true if we should proceed with this request.
|
|