讲socket的时候说到发送都是用send, 怎么在这里看不到调用socket的send函数了?
def server(): # 1. 创建套接字 s = socket.socket() # 2. 绑定 HOST = '127.0.0.1' PORT = 6666 s.bind((HOST, PORT)) # 3. 监听 s.listen(5) # 4. 处理 while True: c, addr = s.accept() print('Connect client: ', addr) msg = c.recv(1024) print('From client: %s' % msg)
# 发送消息 # 这里怎么没有看到send函数的影子? def send(self): for line in self.wbuf: self.wfile.write(line) self.wfile.flush() self.wbuf = []