TCP Drive tag access

First off I am brand new to the Ignition platform and struggling. What I am trying to accomplish is write a string tag to a TCP server using the TCP driver gateway. I have successfully created the gateway and when cycling the enable, disable I verified the connection is working. The problem I am having is for the life of me I can’t figure out how to send the data to the device. Any and all information would be greatly apricated.

Enable the "Writeable" setting, then write to the new tag that will be available: UDP and TCP Driver | Ignition User Manual

I'd take a step back and tell us about the TCP server and what the protocol/conversation looks like, because more often than not the TCP driver is not a good fit, and you should be using scripting for the comms instead.

1 Like

Yes, I have enabled the Writeable setting.

The process is, sending a string \02Telegram Type=Job\nJob ID=1\nRecipe Name=Standard Recipe\nProduct Serial Number=0815abc\03 to the device, this starts a process and then will send a result of the test performed. I have performed this successfully with a Allen Bradley PLC using socket comms, there is just so much information returning we thought that ignition could handle it better.

Have you visited https://inductiveuniversity.com to learn more about Ignition and its capabilities?

You could benefit lots from the OPC-UA module to connect to PLCs and expose tags to read/write.

Some good starting videos relating to just that:

The TCP driver is meant to receive simple and regular input from things like barcode scanners or scales.

This is the most important part. If every single message that will be received from the device can't be parsed by the simple set of message delimiting options, e.g. "every message ends with \r\n", that's where you'll have trouble using the driver instead of a script.

Ok, I’m not opposed to using script if it will be more suitable for the process. I have use structed text on several different processors, but I have never worked with python. Is there any examples you might have, I would just need to open socket, send, close socket.

No, you also need to listen for the response before closing the socket. And maybe hold the socket open for the next request.

A long-lived thread to manage the socket is generally required, and unfortunately, can be tricky. Some references for you:

https://forum.inductiveautomation.com/search?q=long-lived%20thread%20socket%20order%3Alatest

Whatever you do, do NOT use jython's socket library. Use java sockets.

https://forum.inductiveautomation.com/search?q=java.net%20socket%20examples%20order%3Alatest