I would like to put 24 Siemens PLC LOGO! on the network and via a back-end in Python, manage each PLC and the user who wants to upload his LAD file to a specific PLC must first go to the web GUI, select the PLC he needs and then via the Logo Soft Comfort program enter a URL (which will be a generic URL, so if he chooses to use PLC 1 or PLC 2, the URL will not change) to upload the file. Then the user only has to create the LAD file, go to the web GUI, select the PLC to be used and upload the program via Logo Soft Comfort and enter the URL, from here the Python back-end will connect the selected PLC to the user's PC, even if they are not physically connected. Is it possible to do this?
I tried asking Copilot and it generated this code for me, but I don't know if it fits the PLC.
import socket
import select
import time
remote_ip = '192.168.0.3'
remote_port = 20000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('0.0.0.0', 8080))
server.listen(10)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((remote_ip, remote_port))
while True:
ready_to_read, _, _ = select.select([server, client], [], [], 0.1)
for s in ready_to_read:
data = s.recv(4096)
if s == server:
client.send(data)
else:
server.send(data)