1[] Listening on 0.0.0.0:9999
2[] Accepted connection from: 127.0.0.1:62512
3[*] Received: ABCDEF
123がでるとサイトにはあったのですが、2と3は出てこないでずっとプログラムは動いている状態になっています。
123のどれかがでるのか、全てがでるのかは詳しく書いてなかったので、勘違いしているだけかもしれません。
ご指摘よろしくお願いします
コード import socket import threading bind_ip="0.0.0.0" bind_port=9999 server=socket.socket(socket.AF_INET,socket.SOCK_STREAM) server.bind((bind_ip,bind_port)) server.listen(5) print"[*] Listening on %s:%d" % (bind_ip,bind_port) # this is our client-handling thread def handle_client(client_socket): # print out what the client sends request=client_socket.recv(1024) print "[*] Received: %s" % request #send back a packet client_socket.send("ACK!") client_socket.close() while True: client,addr=server.accept() print"[*] Accepted connection from : %s:%d" %(addr[0],addr[1]) #spin up our client thread to handle incoming data client_handler=threading.Thread(target=handle_client,args=(client,)) client_handler.start()
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。