web框架 源码

import socket
def handle_request(client):
    buf=client.recv(1024)
    ckient.send('HTTP/1.1 200 OK

')
    client.send('Hello,world')

def main():
    sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    sock.bind(('localhhost',8080))
    sock.listen(5)

    while 1:
        con,addr=sock.accept()
        handle_request(con)
        con.close()

if __name__=='__main__':
    main()
原文地址:https://www.cnblogs.com/ezway/p/6714224.html