Listener cant get any external connection.

Discussion in 'Programming/Scripts' started by newbie14, Sep 25, 2010.

  1. newbie14

    newbie14 New Member

    Dear All,
    I have a centos 5.5 machine. I have forwarded both port 22 and 9000 on my router. So then I can connect on 22 and remotely login into the machine. The problem when I start my java listener program which is listening on 9000 it cant not establish any connection. I have even add this into the iptables too -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT. I have disabled the SELINUX too. What else must I do to make it work any suggestion please? Thank you.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Maybe it is a problem with your Java program. Do you see it in the output of
    Code:
    netstat -tap
    ?
     
  3. newbie14

    newbie14 New Member

    Dear Falko,
    When I type netstat -tap is not there. But the funny part is that when I type "telnet 192.168.2.15 8080" locally in the same machine but different terminal I can see this statement "Remote Connection Accepted" is printed on the server terminal. Below is my codes which is just few lines. What can be my error ya? Thank you.

    public static void main(String[] args) {



    try {

    InetAddress Address = InetAddress.getByName("192.168.2.15");
    System.out.println(Address);
    final ServerSocket serverSocketConn = new ServerSocket(8080,-1,Address);



    while (true)

    {

    try

    {

    Socket socketConn1 = serverSocketConn.accept();
    System.out.println("Remote Connection Accepted");

    //new Thread(new ConnectionHandler(socketConn1)).start();

    }

    catch(Exception e)

    {

    System.out.println(e.toString());

    }

    }



    }

    catch (Exception e)

    {

    System.out.println(e.toString());

    //System.exit(0);

    }

    }


    QUOTE=falko;240245]Maybe it is a problem with your Java program. Do you see it in the output of
    Code:
    netstat -tap
    ?[/QUOTE]
     

Share This Page