# TCP, How to send a TCP message from Ignition

**URL:** <https://forum.inductiveautomation.com/t/tcp-how-to-send-a-tcp-message-from-ignition/73462>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [May 9, 2023, 11:17am UTC](https://forum.inductiveautomation.com/t/tcp-how-to-send-a-tcp-message-from-ignition/73462 "2023-05-09T11:17:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 9, 2023, 12:29pm UTC](https://forum.inductiveautomation.com/t/tcp-how-to-send-a-tcp-message-from-ignition/73462/2 "2023-05-09T12:29:42Z")

</div>

You would use something like this:

> [@Printing barcode to Zebra printer](https://forum.inductiveautomation.com/t/printing-barcode-to-zebra-printer/8957/11):
>
> Finally made it back to my desk. Here’s a chopped down version of what I use. from java.net import Socket from java.io import DataOutputStream partnum = 'ABCBEFGH' serialNum = '12345678' strMessage100 = "^XA" strMessage110 = "^BY3,3,60^FT065,120,^BCN,N,N,N,N^FDP%s^FS" % partNum strMessage111 = "^FT170,040^A0N,40,45^FD%s^FS" % partNum strMessage112 = "^FT065,260,^BCN,N,N,N,N^FDS%s^FS" % serialNum strMessage113 = "^FT170,170^A0N,40,45^FD%s^FS" % serialNum strMessage199 = "^PQ1,0,1,Y^XZ" strO…

If you want to keep a socket open, or read back from the socket, it gets a whole lot more complicated.

---

_[View the full topic](https://forum.inductiveautomation.com/t/tcp-how-to-send-a-tcp-message-from-ignition/73462)._
