1. 服务端Server
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# www.etdev.net by respeke
import socket
import threading
def tcp_thread(sock,addr):
print('accept new connection from %s,%s'%addr)
rh='HTTP/1.1 200 OK\r\n'
# rh+='Date: Thu, 08 Nov 2018 01:32:36 GMT\r\n'
rh+='Content-Type: text/html\r\n'
rh+='Connection: Keep-Alive\r\n'
rb='<!DOCTYPE html>\r\n'
rb+='<head>\r\n'
rb+='<meta charset="utf-8">\r\n'
rb+='<title>Python WebServer</title>\r\n'
rb+='</head>\r\n'
rb+='<body style="background-color: #97a8b9">\r\n'
rb+='<div style="margin:100px