Compare commits

..

No commits in common. "e7019853cd11e2f0a927fac9f01c147a5b29ae18" and "1b595c64aade28d98ad31e33bac0c38dd0d692eb" have entirely different histories.

View file

@ -58,7 +58,7 @@ def parse_args():
argp = argparse.ArgumentParser() argp = argparse.ArgumentParser()
argp.add_argument('-i', '--ip-address', default="", help="IP Address to bind the server") argp.add_argument('-i', '--ip-address', default="", help="IP Address to bind the server")
argp.add_argument('-p', '--port', type=int, default=8080, help="Port on which to listen for traffic") argp.add_argument('-p', '--port', type=int, default=8080, help="Port on which to listen for traffic")
argp.add_argument('-d', '--debug', action='store_true', help="Run in debug mode") argp.add_argument('-d', '--debug', help="Run in debug mode")
return argp.parse_args() return argp.parse_args()
def create_file(size=1073741824, web_dir=WEB_DIR): def create_file(size=1073741824, web_dir=WEB_DIR):
@ -92,16 +92,11 @@ if __name__ == "__main__":
log.info("Creating 1 gigabyte file...") log.info("Creating 1 gigabyte file...")
create_file(web_dir=os.path.join(WEB_DIR, 'speedtest')) create_file(web_dir=os.path.join(WEB_DIR, 'speedtest'))
# TODO: This should be the client which writes a server listening for this simple_handler = SuperSimpleHandler() # http.server.SimpleHTTPRequestHandler
# client sending a file. A simple Python script like this originally was listening
# on a port for a specific code would allow the file to be written to the /tmp
# directory and then read back down, comparing contents and measuring speed.
# simple_handler = SuperSimpleHandler() # http.server.SimpleHTTPRequestHandler with socketserver.TCPServer((args.ip_address, args.port), SockHandler) as tcpd:
log.info(f"Server started on {args.ip_address}:{args.port}")
#with socketserver.TCPServer((args.ip_address, args.port), SockHandler) as tcpd: tcpd.serve_forever()
# log.info(f"Server started on {args.ip_address}:{args.port}")
# tcpd.serve_forever()
except KeyboardInterrupt as control_c: except KeyboardInterrupt as control_c:
log.info("Server stopped") log.info("Server stopped")