Web框架本质

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()

  

上一篇:IP协议栈在Linux内核中的运行时序分析


下一篇:@2021SC@SDUSC 源码分析: 格加密模块的初窥