Skip to content

Instantly share code, notes, and snippets.

@shonenada
Created September 18, 2015 07:25
Show Gist options
  • Save shonenada/4da76654e1d068fe304c to your computer and use it in GitHub Desktop.
Save shonenada/4da76654e1d068fe304c to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import socket
web_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
web_socket.bind(("127.0.0.1", 8888))
web_socket.listen(5)
while(True):
connection, address = web_socket.accept()
connection.settimeout(120)
msg = connection.recv(2048)
print msg
connection.send("HTTP/1.1 200 OK\r\n\r\nDone\n")
connection.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment