Results 1 to 6 of 6

Thread: trouble connecting to a listening service

  1. #1
    Join Date
    Nov 2018
    Beans
    3

    trouble connecting to a listening service

    Ubuntu 16.04 is running on a TX2.
    - running Ubuntu as a server with (nc -l 50000) works fine, I can connect to from a client (nc ip 50000) and exchange messages
    - however, when running an application on the Ubuntu server, I am NOT able to connect it from the client (using nc ip 50000), wit Connection Timed Out.
    - I have read in another forum (https://support.rackspace.com/how-to...s-with-netcat/), that it might be the firewall, here is the output of iptables on the Ubuntu server:
    Chain INPUT (policy ACCEPT)
    target prot opt source destination


    Chain FORWARD (policy ACCEPT)
    target prot opt source destination


    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    - Debugging the application shows that "accept" always return NULL even if the client is trying to connect.
    Please suggestions?!

  2. #2
    Join Date
    Nov 2013
    Location
    On the edge
    Beans
    872
    Distro
    Ubuntu

    Re: trouble connecting to a listening service

    Reviewing your firewall logs would show whether the firewall is preventing connection.

    Are you connecting to the server from another machine on the network? Over the internet? From the same server?
    Knock knock.
    Race condition.
    Who's there?

  3. #3
    Join Date
    Nov 2018
    Beans
    3

    Re: trouble connecting to a listening service

    Tried both, from another machine on the network and from the sever itself. Both give Timed out

  4. #4
    Join Date
    Nov 2018
    Location
    Lucknow, India
    Beans
    90
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: trouble connecting to a listening service

    - however, when running an application on the Ubuntu server, I am NOT able to connect it from the client (using nc ip 50000), wit Connection Timed Out.
    Is application configured properly to listen/accept messages from port 50000? Please check the same, if possible, by running an script or something on the server.
    Learning...... Little odd way for here, read as much as you can before trying anything....
    and get confused enough to forget the actual task.........

  5. #5
    Join Date
    Feb 2008
    Location
    Texas
    Beans
    29,807
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: trouble connecting to a listening service

    Thread moved to Server Platforms for a more appropriate fit.

  6. #6
    Join Date
    Nov 2018
    Beans
    3

    Re: trouble connecting to a listening service

    Yes, I believe it's configured correctly because simply the same service is running fine on another Linux platform with TS-2760 processor. Here is the line of (netstat -an | grep "LISTEN")

    tcp 0 0 0.0.0.0:50000 0.0.0.0:*
    LISTEN

    The way we initialized the socket is:
    listen_socket = socket(PF_INET, SOCK_STREAM, protocol->p_proto);

    setsockopt(listen_socket, SOL_SOCKET, SO_REUSEADDR, &one, sizeof one);
    bind(listen_socket, (const sockaddr *) &socketaddr, sizeof(socketaddr)
    options = fcntl(listen_socket, F_GETFL);
    options |= O_NONBLOCK;
    fcntl(listen_socket, F_SETFL, options);
    listen(listen_socket, 0);

    accept(listen_socket, (sockaddr *) &this_sockaddr, &size)

    Now, accept() is always return NULL on ubuntu 16.04 even if there is a client trying to connect (nc localhost 50000)
    Last edited by refaatmokhtar; November 15th, 2018 at 03:54 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •