Simple socket server client example not working on Jetpack

Hi,

I’m trying to do some networking for my Senior project and it involves the Jetson communicating to a ground station. I’m testing the networking capability on the jetson and it seems like sockets don’t seem to work.

I tested the same code on my linux machine and on a raspberry pi for verification.

What I get on the Jetson is that the server opens a socket and is in the listening state. I verified this using the command netstat -natp and it shows that I have a socket open and is in the LISTEN state on 127.0.0.1:5000.

When I launch the client it opens a socket and is put in the SYN_SENT state I verified this by running the netstat -natp command. The client is trying to connect to 127.0.0.1:5000 as well. And all I get is a timeout error.

I updated Jetpack to 4.3 and the error persists.

Does anyone have any kind of insight?

Thank you

Hi, pollitopereira

Could check with another port like the default 80? In case the port 5000 is in a block state.
And also could you share your network device? etherenet or wireless.
With etherenet cabe or wireless wifi, the direct network connection should be under the same route.

We’re having the same issue running a simple localhost socket server on C++ and trying to connect with a python client. Code works on a linux laptop.
Already tried changing to port 80 but got a permission denied when running the server code. Running with sudo results in the same problem as before, server starts but client times out without connecting. Running Jetpack 4.3 (R32.3.1).

Hi, guilhermezz32d,

Please open a new topic for your issue. Thanks

Managed to fix the issue, increasing max queue size on the server solved it.

Hi Guildhermzz32d,

I believe I’m seeing the same issue. How did you increase the max queue size on the server?

Hello, if I recall correctly we just increased the parameter on the listen method of the socket server to allow for more failed connections before refusing new ones. I primarily deal with sockets in python so not sure about the C++ implementation. In python you would specify that argument like so:

# Echo server program
import socket

HOST = ''                 # Symbolic name meaning all available interfaces
PORT = 50007              # Arbitrary non-privileged port
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.bind((HOST, PORT))
    s.listen(5) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Queue size/backlog parameter = 5
    conn, addr = s.accept()
    with conn:
        print('Connected by', addr)
        while True:
            data = conn.recv(1024)
            if not data: break
            conn.sendall(data)

from python docs:

socket.listen([backlog])

Enable a server to accept connections. If backlog is specified, it must be at least 0 (if it is lower, it is set to 0); it specifies the number of unaccepted connections that the system will allow before refusing new connections. If not specified, a default reasonable value is chosen.