class chkReply(threading.Thread): def __init__ (self,reply): threading.Thread.__init__(self) self.reply = reply def run(self): #print "waiting for " + strtohex(self.reply) data2 = "" while data2 != self.reply: data2 = s.recv(4096) #print "[" + strtohex(data2) + "]" print "reply OK" self.reply = "" global wait wait = 0