|
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='\r\n'
- ? ? rb+='\r\n'
- ? ? rb+='\r\n'
- ? ? rb+='Python WebServer\r\n'
- ? ? rb+='
\r\n'
- ? ? rb+='\r\n'
- ? ? rb+='
\r\n'
- ? ? rb+='\r\n'
- ? ? rb+='
电子技术开发网 - ETDev,电子技术、嵌入式技术交流分享园地 '
- ? ? rb+='
\r\n'
- ? ? rb+='
\r\n'
- ? ? rb+='
|
|