I need to acces second time to tcp server in Python -


this server code. need connect 2 times must same time. maybe thread wrong. don't know need help.

import threading import socket import random   soket=socket.socket(socket.af_inet,socket.sock_stream) num=random.choice(range(101))  host="0.0.0.0" port=7972  soket.bind((host,port)) print ("%s : %d server balşatıldı" % (host,port))   soket.listen(5) print "kullanıcı bekleniyor" conn,adres=soket.accept() print "bağlantı kuruldu." def dinle():      print num      data=conn.recv(1024)     print data     conn.sendall("hoşgeldiniz\nbir sayı tuuttum bakalım bulabilecekmisin?" )     while true:          tahmin=int(conn.recv(1024))         if tahmin==num:             conn.sendall("tebrikler")             break          else:             conn.sendall("bulamadın")  in range(10):     t1=threading.thread(target=dinle)     t1.start()     t1.join()     soket.close() 

this easy number guessing game. can solve please.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -