Connecting two computers over ethernet (TCP socket python)

I just wanted to share my method of point to point communication between two computers using a Jetson TK1 and linux desktop.

Connect Jetson TK1 and Linux PC using RJ45 cable

  1. Set ethernet IP address for both Jetson and PC
    For Jetson: sudo ip ad add dev eth0
    For PC: sudo ip ad add dev eno1

  2. Check the assigned IP address by using “ifconfig” command in terminal We can also ensure by using the command ==>
    nmap -p 80 (IP address of other device)
    which returns the following in case everything is successfully connected

Starting Nmap 7.80 ( ) at 2020-11-24 11:54 IST
Nmap scan report for
Host is up (0.00064s latency).
80/tcp closed http
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

Then do
ping address of other device)

  1. Run in Jetson and in the LINUX PC .
    IN the Jetson: Connected by (‘’,37240)
    IN the PC: Received b’Hello , world’
    NOTE: is the IP address of Jetson and is the IP address of PC
    The TCP connection is now established

import socket
HOST = ''  # Standard loopback interface address (localhost)
PORT = 65432        # Port to listen on (non-privileged ports are > 1023)

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
conn, addr = s.accept()
with conn:
    print('Connected by', addr)
    while True:
        data = conn.recv(1024)
        if not data:

import socket
HOST = ''  # The server's hostname or IP address
PORT = 65432        # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    s.sendall(b'Hello, world')
    data = s.recv(1024)

print('Received', repr(data))

Cool! Thanks for your sharing to community!