I think it's good now !!!!
There was a mistake with the backslash of /r/n, it's not "/" we have to use but "\" !
I figured it out by reading the document Bruinlax give me first.
Now, the script is :
Code: Select all
import socket
from time import sleep
import sys
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = '192.168.1.20'
PORT = 4998
sock.connect((HOST, PORT))
sock.settimeout(2)
sock.sendall("get_NET,1:1"+"\r")
while True:
try:
msg = sock.recv(4096)
except socket.timeout, e:
err = e.args[0]
# this next if/else is a bit redundant, but illustrates how the
# timeout exception is setup
if err == 'timed out':
sleep(1)
print 'recv timed out, retry later'
sys.exit(1)
#continue
else:
print e
sys.exit(1)
except socket.error, e:
# Something else happened, handle error, exit, etc.
print e
sys.exit(1)
else:
if len(msg) == 0:
print 'orderly shutdown on server end'
sys.exit(0)
else:
# got a message do something :)
print msg
sock.close()
With your command, I still get an ERR_0:0,001 :
self.errCodeMap = {
"001" : "Invalid command. Command not found.",
BUT !
With my previous IR command which is good for GC100, I get :
Python Script
completeir,1:1,1
recv timed out, retry later
And the LED blinks !
My command is working !
I don't understand all your script but it's good now, except that "recv timed out, retry later"...
Thanks a lot !
