# Gateway Event Script (Sending request through TCP)

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-script-sending-request-through-tcp/17475>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [March 23, 2018, 1:33pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-sending-request-through-tcp/17475 "2018-03-23T13:33:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![r\_sjm](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@r\_sjm](https://forum.inductiveautomation.com/u/r_sjm)\
**Post date:** [March 23, 2018, 1:33pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-sending-request-through-tcp/17475/1 "2018-03-23T13:33:51Z")

</div>

I’m having trouble trying to send some values over TCP using client event timing script. Here is my code, but nothing is sending.

```auto
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = 'insert IP here'
PORT = 1111111
s.connect((HOST, PORT))
s.send('message')
s.close()

```

I’ve followed the Ignition 5 day training book to make a timer screen, but the result was unsuccessful. If I execute the code on Script Console, it works. What am I missing?

---

<div class="post-metadata">

**Author:** ![r\_sjm](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@r\_sjm](https://forum.inductiveautomation.com/u/r_sjm)\
**Post date:** [March 23, 2018, 1:58pm UTC](https://forum.inductiveautomation.com/t/gateway-event-script-sending-request-through-tcp/17475/2 "2018-03-23T13:58:07Z")

</div>

Turns out, the device was ran over. Retested the code with another device, and it works now.
