Gateway Event Script (Sending request through TCP)

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

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?

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