Created
May 16, 2023 11:07
-
-
Save MichaelStett/4390bea05d524498b0888d0c80172da9 to your computer and use it in GitHub Desktop.
Create server on given ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.server | |
import socketserver | |
import sys | |
PORT = int(sys.argv[1]) | |
print(f"Port {PORT}") | |
if PORT == "": | |
exit(-1) | |
Handler = http.server.SimpleHTTPRequestHandler | |
with socketserver.TCPServer(("", PORT), Handler) as httpd: | |
print(f"Serving on port {PORT}") | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment