realized there is more to do to make the speedtest functional
This commit is contained in:
parent
cc360921fc
commit
2307567805
15
speedtest
15
speedtest
@ -58,7 +58,7 @@ def parse_args():
|
||||
argp = argparse.ArgumentParser()
|
||||
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('-d', '--debug', help="Run in debug mode")
|
||||
argp.add_argument('-d', '--debug', action='store_true', help="Run in debug mode")
|
||||
return argp.parse_args()
|
||||
|
||||
def create_file(size=1073741824, web_dir=WEB_DIR):
|
||||
@ -92,11 +92,16 @@ if __name__ == "__main__":
|
||||
log.info("Creating 1 gigabyte file...")
|
||||
create_file(web_dir=os.path.join(WEB_DIR, 'speedtest'))
|
||||
|
||||
simple_handler = SuperSimpleHandler() # http.server.SimpleHTTPRequestHandler
|
||||
# TODO: This should be the client which writes a server listening for this
|
||||
# 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.
|
||||
|
||||
with socketserver.TCPServer((args.ip_address, args.port), SockHandler) as tcpd:
|
||||
log.info(f"Server started on {args.ip_address}:{args.port}")
|
||||
tcpd.serve_forever()
|
||||
# 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}")
|
||||
# tcpd.serve_forever()
|
||||
|
||||
except KeyboardInterrupt as control_c:
|
||||
log.info("Server stopped")
|
||||
|
Loading…
Reference in New Issue
Block a user