Python and Socket not responding

Hello all!

I am trying to query my timers via a simple python script.
import socket

TCP_IP = ''
TCP_PORT = 2101
MESSAGE = 'AA03E96A03'.decode('hex')
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
data = s.recv(BUFFER_SIZE)

print "received data:", data

Unfortunately when i run it i get the following output

PS C:\Users\teknix\Cooker\ncd-fusion-client> python.exe .\
Traceback (most recent call last):
  File ".\", line 10, in <module>
    s.connect((TCP_IP, TCP_PORT))
  File "C:\Python27\lib\", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it

any idea why it would deny me?


It’s possible the connection is failing because the IP address is incorrect or because other software is already connected to the board. Keep in mind the board only allows 1 TCP socket connection at a time so if you have something like NCD Base Station or N Button software connected your Python script will not be able to connect to the board.

Thank you Travis, I had totally spaced the connection limit lol
That will teach me for posting later in the day :slight_smile:

No problem. Let us know if you need anything else.