Plc and jetson nano connection problem

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.’)

Hello,

Welcome to the NVIDIA Developer forums! Your topic will be best served in the Jetson category.

I will move this over for better visibility.

Cheers,
Tom

I don’t have experience on this network programming issue, suggest to google it to find the suggestions. Sorry for that.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.