def main():
try:
# Create end point
endpoint = TCP4ServerEndpoint(
reactor=reactor,
port=8000,
interface='127.0.0.1',
)
# Start listening
endpoint.listen(Factory.forProtocol(EchoProtocol))
# Run reactor
reactor.run()
# If have `KeyboardInterrupt`
except KeyboardInterrupt:
# Stop gracefully
pass
# Trace calls in this module.
#
# Calling this function is needed because at the point `trace_calls_in_specs`
# is called, this module is being initialized, therefore callables defined
# after the call point are not accessible to `trace_calls_in_specs`.
#
EchoTCPServerTraceCall.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录