Write text to a port 11002

Good morning,

I want to write a string to a port (11002) on the same PC my Ignition gateway is installed on. Does Ignition offer any built in functions to accomplish this?

Thanks for any info.

All of java’s built-in networking is available. java.net.Socket.

1 Like

Thanks, I’ll look into Java solutions.

I came up with this code

import socket
import sys

TCP_IP = '127.0.0.1'
TCP_PORT = 11002

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))

s.send('some string of information')

s.close()

Spits out the length of the string in the console… I think it is working but the API on the device side is now my current problem.

Python’s socket package is notoriously buggy and slow in jython. I recommended the java classes very deliberately.

1 Like

I feel like we have this conversation once a month pturmel. :grinning:

I need to sit down and just learn the syntax of Java.

Not syntax. You still use jython syntax for java classes inside jython. The methods are different.

1 Like