I am trying to connect to Siemens S7 1200 via TCP IP. I can ping it and it gets a response without any problems. When I run the same code on Windows, I can get the data. but when I run the following code on jetson nano, I get the following error: s.connect((HOST, PORT))
ConnectionRefusedError: [Errno 111] Connection refused
import socket
HOST = ‘192.168.0.1’
PORT = 2000
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
# Veri gönder
s.sendall(b'Hello, server!')
while True:
data = s.recv(1024)
if not data:
break
try:
decoded_data = data.decode('utf-8')
print('Received', decoded_data)
except UnicodeDecodeError:
decoded_data = data.decode('ISO-8859-1')
print(decoded_data)
print(‘connection closed.’)