我正在按照一些示例代码在asyncore
此处使用,仅在以下完整示例中设置了一个timeout
值:asyncore.loop
import smtpd
import asyncore
class CustomSMTPServer(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpttos, data):
print 'Receiving message from:', peer
print 'Message addressed from:', mailfrom
print 'Message addressed to :', rcpttos
print 'Message length :', len(data)
return
server = CustomSMTPServer(('127.0.0.1', 1025), None)
asyncore.loop(timeout = 1)
我预计 1 秒后会发生超时,但事实并非如此。代码运行时间超过一秒。我在这里想念什么?