HTML介绍

web服务本质

import socket

def main():

    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.bind(('localhost',8081))
    sock.listen(5)

    while True:
        print("server is working.....")
        conn, address = sock.accept()

        request = conn.recv(1024)

        conn.sendall(bytes("HTTP/1.1 201 OK\r\n\r\n<h1>Hello World</h1>","utf8"))
        conn.close()

if __name__ == '__main__':

    main()
web本质之socket

相关文章:

  • 2021-09-21
  • 2021-10-29
  • 2021-11-23
  • 2021-10-10
  • 2022-01-12
  • 2021-04-10
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2021-06-04
  • 2021-05-26
  • 2021-10-06
  • 2022-02-27
  • 2021-09-06
  • 2021-12-24
相关资源
相似解决方案