Communicating to Third Party TCP Client through Ignition Gateway

I am trying to figure out the best way to accomplish utilizing Ignition to communicate ASCII string data to a third party TCP client. The process would work like this:

  • Panelview has a hand scanner connected to it via USB.
  • Operator scans a work order and string data gets saved to a tag.
  • Ignition monitors the PLC tag where that data is stored.
  • On change, send the string to a third-party TCP client.
  • The frequency of hand scan tag change would be around once per 1-2 hours.

I am trying to figure out which options would be available for this. I am not versed in TCP communication other than using the native TCP driver in Ignition to request information from a Moxa unit in a passive manner.

Hoping someone may be able to give me some advice.

  • Is it possible to use the built-in TCP driver for this application?
  • I’ve read through the forums and understand that opening a socket through jython is risky, and it not handled properly, can cause all kinds of issues.

Thanks for any advice in advance!

Can you clarify this? If taken at face value and the third party really is a TCP Client, that means the only way this works is if Ignition acts as a TCP Server to which that client constantly connected and just waiting for data to arrive over the socket.

Possible, but the terminology is just weird enough to make me question.

The TCP driver won't help you here - it does the thing your TCP client would be doing. You would have to do this in scripting or with a module.

Hi Kevin,

Thanks for the quick response.

Apologies if I’m not clear. I’m new to this type of protocol. It might help if I explain the current configuration:

  • Hand scanner is connected to a Moxa box.

  • The third-party client (it is called Clarinet Scanpoint by Videojet) receives the Moxa box string and processes it sending it to a Videojet printer on the plant floor.

We want to use Ignition as the Moxa box if this is possible and reliable.

One detail I think is important is Clarinet can also be configured as a TCP server, but I don’t think this helps with how the application is intended to work?

Hopefully I answered your question.

Thanks,

Josh

It might...

Have you already verified that you can get the scanner result to land in an Ignition tag?

If so, then maybe a gateway tag change script that just connects to Clarinet configured as a TCP server, writes the data, then disconnects each time the tag changes would work.

Yes, we do this with hand scanners connected to Panelviews in other production cells.

I was reading in another thread doing this is not reliable and can potentially cause memory leaks and/or threads to get locked up.

Can you make any recommendations for the right jython modules to import and script flow?

from java.net import Socket, InetSocketAddress
from java.io import BufferedOutputStream

socket = Socket()
try:
    socket.connect(InetSocketAddress("192.168.1.10", 5000), 5000)
    socket.soTimeout = 5000

    out = BufferedOutputStream(socket.outputStream)
    out.write("Hello, device!\r\n".encode("utf-8"))
    out.flush()
finally:
    socket.close()

Don't need me for this, just ask your favorite LLM.

1 Like