import socket
def handle_request(client):
buf=client.recv(1024)
ckient.send('HTTP/1.1 200 OK\r\n\r\n')
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
相关资源:Web前端开发框架源码