简单的复用accep

s = socket.socket()
adress = ("192.168.15.102", 9999)
s.bind(adress)
s.listen()
s.setblocking(False)
while 1:
    try:
        conn ,  addr = s.accept()
        print(conn.recv(1024).decode("utf-8"))
    except BlockingIOError:
        print("干活了")

    time.sleep(0.2)

 

posted @ 2018-10-30 21:03  python传言  阅读(194)  评论(0编辑  收藏  举报