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 = ‘’
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:

        decoded_data = data.decode('utf-8')
        print('Received', decoded_data)
    except UnicodeDecodeError:

        decoded_data = data.decode('ISO-8859-1')

print(‘connection closed.’)


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

I will move this over for better visibility.


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