91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.79KB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2021-01-30
  • 語言: Python
  • 標簽:

資源簡介

Python SocketServer, threading

資源截圖

代碼片段和文件信息


import?SocketServer?threading?json

conn?=?{}
conn_lock?=?threading.Lock()

class?ThreadingServer(SocketServer.ThreadingMixIn\
??????????????????????SocketServer.TCPServer):
????allow_reuse_address?=?True

class?Handler(SocketServer.StreamRequestHandler):
????def?handle(self):
????????print?“A?new?client?connected“?self.client_address
????????msg?=?json.read_stream(self.rfile)
????????if?“!name“?in?msg:
????????????name?=?msg[“!name“]
????????????wlock?=?threading.Lock()
????????????conn_lock.acquire()
????????????conn[name]?=?(wlock?self.wfile)
????????????conn_lock.release()
????????????print?“Client?registered?(%s)“?%?name
????????????reply?=?{“ok“:?u“registered“}
????????????self.wfile.write(json.write(reply))
????????????self.wfile.flush()
????????else:?
????????????reply?=?{“er

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2040??2010-04-19?23:05??080-jsongateway.py

評論

共有 條評論