I have a Siemens s1200 plc TCP/IP client demo made with python. I it works and found it from Youtube: https://www.youtube.com/watch?v=5KLLeQeB2EY
My question is, how to translate this code to a java program. I'm currently working on a project to read data from the plc to a java client(and later from java to the plc) and I am currently bit stuck with this project.
This python demo writes "testi1" string on console when run and i'm looking for bringing more data from the "output1" datablock. Picture of the datablock attached.
Kindly asking for help.
Cheers
import socket
HOST = '192.168.0.1' #plc ip
PORT = 2000 # plc port
if __name__ == "__main__":
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as conn:
conn.connect((HOST, PORT))
print(conn.recv(1024).decode('UTF-8', errors='ignore')) #.decode('UTF-8', errors='ignore') erases some nonsense output