I'm just testing out some if statements right now and I'm comparing strings. Here is my code:
#infinite loop so that function do not terminate and thread do not end.
while True:
#Receiving from client
data = conn.recv(1024)
reply = 'OK...' + data
light = 'light'
print 'TESTING'
if data == 'light':
print 'Light 1 On'
#class Command(cmd.Cmd):
#Simple command processor example.
#def do_greet(self, line):
#print "hello"
#def do_EOF(self, line):
#return True
#if __name__ == '__main__':
#Command().cmdloop()
if not data:
break
conn.sendall(reply)
#came out of loop
conn.close()
I can't tell what I'm doing wrong but it doesn't seem to want to work.
Thanks!
Aucun commentaire:
Enregistrer un commentaire