# TCP send message

**URL:** <https://forum.inductiveautomation.com/t/tcp-send-message/81555>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [November 6, 2023, 4:55pm UTC](https://forum.inductiveautomation.com/t/tcp-send-message/81555 "2023-11-06T16:55:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alfredo\_Egmo](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Alfredo\_Egmo](https://forum.inductiveautomation.com/u/Alfredo_Egmo)\
**Post date:** [November 6, 2023, 4:55pm UTC](https://forum.inductiveautomation.com/t/tcp-send-message/81555/1 "2023-11-06T16:55:47Z")

</div>

Is there a way to send a TCP Message from Ignition to a device?

1. Make the tcp connection in a port
2. Send the message
3. Close the connection

thanks

---

<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:** [November 6, 2023, 4:57pm UTC](https://forum.inductiveautomation.com/t/tcp-send-message/81555/2 "2023-11-06T16:57:23Z")

</div>

[https://docs.inductiveautomation.com/display/DOC81/UDP+and+TCP+Driver](https://docs.inductiveautomation.com/display/DOC81/UDP+and+TCP+Driver)

---

<div class="post-metadata">

**Author:** ![Alfredo\_Egmo](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Alfredo\_Egmo](https://forum.inductiveautomation.com/u/Alfredo_Egmo)\
**Post date:** [November 6, 2023, 5:02pm UTC](https://forum.inductiveautomation.com/t/tcp-send-message/81555/3 "2023-11-06T17:02:06Z")

</div>

thanks, but More than use a Driver I need to make the connection/send message/close connection.

---

<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:** [November 6, 2023, 5:20pm UTC](https://forum.inductiveautomation.com/t/tcp-send-message/81555/4 "2023-11-06T17:20:46Z")

</div>

See this discussion (and particularly note the strong advice **against** python's socket module):

> [@Opening Sockets to TCP devices using scripting](https://forum.inductiveautomation.com/t/opening-sockets-to-tcp-devices-using-scripting/76860/11):
>
> Yes. It's unfortunate, but you're just setting yourself up for failure if you use socket directly. Chat-GPT translated java.net.Socket equivalent of your snippet, that looks approximately correct: # Jython Client using java.net.Socket import java.net.Socket import java.io.IOException TCP\_IP = '192.168.1.100' TCP\_PORT = 17001 CONNECTION\_TIMEOUT = 5000 # The timeout is specified in milliseconds try: s = Socket(TCP\_IP, TCP\_PORT) s.setSoTimeout(CONNECTION\_TIMEOUT) out\_stream = s.g…

---

<div class="post-metadata">

**Author:** ![Alfredo\_Egmo](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Alfredo\_Egmo](https://forum.inductiveautomation.com/u/Alfredo_Egmo)\
**Post date:** [November 6, 2023, 5:24pm UTC](https://forum.inductiveautomation.com/t/tcp-send-message/81555/5 "2023-11-06T17:24:55Z")

</div>

thanks
