We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What does this do?
import socket file = open('website/index.html', 'r') def start_server(HOST, PORT): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((HOST, PORT)) s.listen(1) print('Serving HTTP on port %s ...' % PORT) while True: client_connection, client_address = s.accept() request = client_connection.recv(1024) print(request.decode('utf-8')) http_response = """\ 200 OK """ + file.read() + """ """ client_connection.sendall(bytes(http_response, 'utf-8')) client_connection.close()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What does this do?
import socket file = open('website/index.html', 'r') def start_server(HOST, PORT): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((HOST, PORT)) s.listen(1) print('Serving HTTP on port %s ...' % PORT) while True: client_connection, client_address = s.accept() request = client_connection.recv(1024) print(request.decode('utf-8')) http_response = """\ 200 OK """ + file.read() + """ """ client_connection.sendall(bytes(http_response, 'utf-8')) client_connection.close()
The text was updated successfully, but these errors were encountered: