哟,哟,哟,,SELECT,EPOLL之类的,终于出现了。
不能太急了,要缓一缓,缓一缓,再缓一缓~~~~~~~~~
http://scotdoyle.com/python-epoll-howto.html
import socketEOL1 = b'\n\n'EOL2 = b'\n\r\n'response = b'HTTP/1.0 200 OK\r\nDate: Mon, 1 Jan 1996 01:01:01 GMT\r\n'response += b'Content-Type: text/plain\r\nContent-Length: 13\r\n\r\n'response += b'Hello, world!'serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)serversocket.bind(('0.0.0.0', 8080))serversocket.listen(1)connectiontoclient, address = serversocket.accept()request = b''while EOL1 not in request and EOL2 not in request: request += connectiontoclient.recv(1024)print(request.decode())connectiontoclient.send(response)connectiontoclient.close()serversocket.close()