# TCP/IP Client Service

**URL:** <https://forum.inductiveautomation.com/t/tcp-ip-client-service/55118>\
**Category:** Ignition\
**Created:** [January 18, 2022, 4:14pm UTC](https://forum.inductiveautomation.com/t/tcp-ip-client-service/55118 "2022-01-18T16:14:47Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [January 26, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/tcp-ip-client-service/55118/6 "2022-01-26T22:19:22Z")

</div>

Hi @pturmel,

As mentioned in the [other](https://forum.inductiveautomation.com/t/import-socket-error/29353/7) 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:

```auto
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

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/tcp-ip-client-service/55118)._
