[英]How do i take picture from client side(html) and save it to server side(Python)
[英]Python : How do server come to know of network failure at the client side?
我正在使用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()
謝謝
您必須(1)使用讀取超時和(2)確保在讀取或寫入套接字時對所有錯誤條件做出適當的反應。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.