TCP/IP Client Service

Hi @pturmel,

As mentioned in the other thread, I am having trouble with python sockets on a tag event script which I am trying to use to get the long running thread started (and to stop it).

I have not done anything with java within Ignition before, would you be able to provide me with an example?

This is some of the python script I am trying to translate to java:

import socket
import sys

paths = ["[default]Client/State", "[default]Client/Command"]
values = system.tag.readBlocking(paths)
state = values[0].value
command = values[1].value
if command == 1 and state == 0:
	values = [1, 0]
	system.tag.writeBlocking(paths, values)
	try:
		sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		server_address = ('MACHINE', 53005)
		sock.connect(server_address)
		index = 1
		while True:
			char = ''
			row = ''
			while True:
				char = sock.recv(1)
				if char == '\r':
					char = sock.recv(1) #'\n'
					break
				else:
					row += char
			print row