0

I downloaded the python example client program from official website https://www.redrat.co.uk/software/redrat-hub/redrat-hub- python-example-client-code/
I connected the REDRAt-X with my PC via router and I changed the IP address inside the demo program accordingly but I am facing an error:

client.OpenSocket('192.168.1.7', 40000).

Kindly help to resolve this issue.

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

Here is my code:

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.");'
user207421
  • 305,947
  • 44
  • 307
  • 483

0 Answers0