# 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:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans\_odgaard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hans_odgaard/32/83110_2.png) [@hans\_odgaard](https://forum.inductiveautomation.com/u/hans_odgaard)\
**Post date:** [May 9, 2023, 11:17am UTC](https://forum.inductiveautomation.com/t/tcp-how-to-send-a-tcp-message-from-ignition/73462/1 "2023-05-09T11:17:12Z")

</div>

Have tried various solutions, but have not yet succeed in send a message to my CCTV Server via TCP.  
The reason going this way is that I need to shut down all my CCTV cameras when one of doors are opened on my packing lines. Since ignition already know the status of the doors on all my packing lines I would like to use ignition to send a tcp message to my CCTV server to stop recording on line X.

Does anyone have had the success to write via the tcp ?

---

<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.

---

<div class="post-metadata">

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

</div>

thanks, will give it a try.  
However I would properly need a feedback from the CCTV server that it had received the message otherwise the unions will be in our(mine) heels if they find out that the recording wasn't stopped.

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [May 9, 2023, 12:54pm UTC](https://forum.inductiveautomation.com/t/tcp-how-to-send-a-tcp-message-from-ignition/73462/4 "2023-05-09T12:54:40Z")

</div>

Thinking outside the box,

if the cameras' are PoE, have them all on one PoE switch and turn off power to that switch. Use a DPDT relay and bring feedback to Ignition that the relay activated.

Most NVRs can have SNMP as an add-on, and there are a few SNMP modules for Ignition.

---

<div class="post-metadata">

**Author:** ![hans\_odgaard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hans_odgaard/32/83110_2.png) [@hans\_odgaard](https://forum.inductiveautomation.com/u/hans_odgaard)\
**Post date:** [May 9, 2023, 1:05pm UTC](https://forum.inductiveautomation.com/t/tcp-how-to-send-a-tcp-message-from-ignition/73462/5 "2023-05-09T13:05:44Z")

</div>

Could be a solution, but since I'm in pharma changes to setup on the line involves a lot of hassle, but yes they are poe. The tcp message is for the NVR (Cognify) which only sems to talk tcp or http
