多进程
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/31 0031 19:49 # @Author : BWM # @File : 服务端.py # @Software: PyCharm import socketserver class MyServer(socketserver.BaseRequestHandler): def handle(self): while 1: from_client_data=self.request.recv(1024).decode("utf-8") # name = big & pwd = 123 # print('1111') # print(from_client_data,type(from_client_data)) name_pwd=from_client_data.split("name=") # name = big print("name_pwd",name_pwd) name=name_pwd[1].split("&pwd=")[0] pwd=name_pwd[1].split("&pwd=")[1] print("name",name) print("pwd",pwd) if name=="big" and pwd =="123": self.request.send("HTTP/1.1\r\n 200 OK \r\n <h1>True</h1>".encode("utf-8")) print("登录成功") if __name__ == '__main__': ip_port=("127.0.0.1",8888) socketserver.TCPServer.allow_reuse_address = True server = socketserver.ThreadingTCPServer(ip_port, MyServer) server.serve_forever()
追寻互联网科技、程序编码、软件设计、有限元网格划分、流场分析、求解算法等尖端技术,在迈向技术巅峰的道路上,不断的前行。 或许我不是跑的最快的,但我会是一直在跑的!