我从官方下载了python示例客户端程序
网站https://www.redrat.co.uk/software/redrat-hub/redrat-hub-
python-example-client-code/
我通过路由器将 REDRAt-X 与我的 PC 连接,并更改了 IP
演示程序中的相应地址,但我遇到了错误:
client.OpenSocket('192.168.1.7', 40000).
请帮助解决此问题。
age@age-Latitude-E7470:~/Downloads/Python-Client$ python RedRatHubDemo.py
Traceback (most recent call last):
File "RedRatHubDemo.py", line 12, in <module>
client.OpenSocket('192.168.0.127', 40033)
File "/home/age/Downloads/Python-Client/RedRatHub.py", line 18, in OpenSocket
self.sock.connect((ip, port))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused
这是我的代码:
import RedRatHub
import time
client = RedRatHub.Client()
# Connect to the RedRatHub
client.OpenSocket('192.168.1.7', 40000)
# Send some IR signals
client.SendMessage('"ip="192.168.1.40" dataset="Sky+" signal="9"
output="12:10"')
print("Sent signal\n")
time.sleep(2)
client.SendMessage('"ip="192.168.1.40" dataset="Sky+" signal="9"
output="12:10"')
print("Sent signal\n")
time.sleep(2)
client.SendMessage('"ip="192.168.1.40" dataset="Sky+" signal="9"
output="12:10"')
print("Sent signal\n")
time.sleep(2)
# List the datasets known by the hub
print("List of datasets:")
list = client.ReadData('hubquery="list datasets"')
print(list)
client.CloseSocket()
print("Finished.");'