Hello I'm attempting to send ASCII messages to a thermotron8800 controller via the script console calling the following gateway script. I keep getting a 'failed to connect connection refused error when testing the socket connection. I'm thinking I'll need to use a different socket for communication or is there a better way to send/receive status messages from Ignition to the controller?
def test_connection(ip, port):
import socket
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((ip, port))
status = "Connection successful"
except socket.error as e:
status = "Failed to connect: {0}".format(e)
finally:
sock.close()
return status