Hi,
does any of you have any idea why the self.status variable is not rewritten?
When I run the script below, although it connects to the ip and port mentioned, and receives a message, the self.status is still "down"
the otuput is :
192.168.0.1 down
it should be:
192.168.0.1 'message received'
I am running python 2.5.2 on debian 5.0.4 64bit
#!/usr/bin/env python
from threading import Thread
class testit(Thread):
def __init__ (self,ip):
Thread.__init__(self)
self.ip = ip
self.status = "down"
def run(self):
PORT = 1000
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.settimeout(3)
s.connect((self.ip, PORT))
s.send('u\n')
data = s.recv(1024)
s.close()
self.status = repr(data)
current=testit("192.168.0.1")
current.start()
print current.ip,current.status