import socket sk = socket.socket() sk.bind(("127.0.0.1",8080)) sk.listen() while True: conn, addr = sk.accept() data = conn.recv(8192) print(str(data, encoding="utf-8")) conn.send(b'HTTP/1.x 200 ok\r\nContent-Type: text/html\r\n\r\n') conn.send(b'<head><link rel="icon" href="data:image/ico;base64,aWNv"></head>') conn.send(b'Hello,BJ') conn.close()