python : How do server come to know of network failure at the client side?

标签 python networking network-programming twisted

我正在使用 twisted 模块在 Python 中开发基于聊天的应用程序。 在建立连接一段时间后,假设客户端网络连接失败。

如何确保服务器收到有关网络故障的通知?

这是代码片段(服务器程序):

def main():
    """This runs the protocol on port 8000"""



    factory = protocol.ServerFactory()
    factory.protocol = Echo
    PortNo = 8000
    reactor.listenTCP(PortNo,factory)

    reactor.run()

# this only runs if the module was *not* imported
if __name__ == '__main__':
    main()

谢谢

最佳答案

关于 python : How do server come to know of network failure at the client side?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16852102/

相关文章:

c - 如何确保服务器在可能的情况下监听 IPv6 而在其他情况下监听 IPv4?

android - 如果有互联网连接,我可以使用 PC 检查模拟器吗?

security - 您将如何测试 SSL 连接?

python - 为什么嵌套函数比非嵌套函数慢这么多?

python - 如何打印列表中每 50 个值?

c# - 在读取内容之前从套接字接收全部数据

network-programming - 管理 UDP 套接字的安全性

python - 在没有库的python中自定义crc32计算

python - 如何在 python 中将 <None> 类型对象的输出重定向到文本文件?

linux - 为什么在调试 vmlinux 时 kgdb 不显示函数符号?