Code: Select all
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 20007)) # Specify the target device and port number
print s.recv(1024) # Writes anything it tells you when it first connects to the log for troubleshooting. If there's no initial connect string, you can probably remove this line
s.send("print('test')\n") # You could also do eg.event.payload[0] and pass commands to this script from other events.
print s.recv(1024) # Writes anything it tells you after your command is sent to the log for troubleshooting
s.close()Code: Select all
eg.globals.ToGirder1 = (("print"))
eg.globals.ToGirder2 = eg.event.payload[0]
eg.globals.ToGirder3 = (("\n")
eg.globals.ToGirder = eg.globals.TilGirder1 + eg.globals.TilGirder2 + eg.globals.TilGirder3
s.send(eg.globals.TilGirder)