Package concurrent_tree_crawler :: Package common :: Module delayed_http_files_server :: Class DelayedHTTPFilesServer
[hide private]
[frames] | no frames]

Class DelayedHTTPFilesServer

source code

HTTP Files server with a new thread created for each new connection. Execution of work of each thread is delayed by a given amount of time.

Instance Methods [hide private]
 
__init__(self, directory_to_serve, delay, host='localhost', port_no=0) source code
 
start(self)
Start the server in a new thread.
source code
 
stop(self)
Stop the server and wait until it shuts down
source code
 
__enter__(self) source code
 
__exit__(self, type_, value, traceback) source code
Method Details [hide private]

__init__(self, directory_to_serve, delay, host='localhost', port_no=0)
(Constructor)

source code 
Parameters:
  • directory_to_serve - directory which will be served
  • delay - delay time of serving each page in seconds
  • host - server's host address
  • port_no - number of port to listen on. Port 0 means that the server will use an arbitrary unused port.

start(self)

source code 

Start the server in a new thread.

Returns:
server's (IP address, port number) pair