Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import ctime
- from socket import *
- #print(gethostname())
- s = socket(AF_INET, SOCK_STREAM)
- s.bind(('127.0.0.1', 12007))
- s.listen(1)
- try:
- while True:
- conn, add = s.accept()
- message = conn.recv(1000)
- if message: print(message.decode())
- #conn.send('HTTP/1.1 404 Not Found\r\n\r\n'.encode())
- conn.send('HTTP/1.1 200 OK\r\n\r\n'.encode())
- resp = '<b>Hello</b>' + str(ctime())
- conn.send(resp.encode())
- pass
- finally:
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement