Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Making Java listen to port. - Linux Newb Needs Help

    I've been working with the shell for a couple years, but always very generic stuff for building programs (c++, etc). I've never actually had my own server.

    Well, now I need one. So I now have a linux server with Fedora on it. I'm not even sure what version of Fedora it is. I typed uname -a and maybe this will tell you guys what I have:

    Linux BattleTech 3.1.0-7.fc16.x86_64 #1 SMP Tue Nov 1 21:10:48 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

    So I built a Java app that listens to a port that I will be using for an android app I am making. It used to listen just fine on my brothers server, but now that I have it up on my own, it says it's listening, but it never receives anything. I've tried connecting from my phone app, but nothing works. I'm pretty sure if I request it via command line, it should still work. Is there something I need to do to free up ports here?


  2. #2
    Running netstat shows this:

    tcp 0 0 :::443 :::* LISTEN

    What does :::443 mean? It's suppose to be listening to port 443, but I don't know what the ::: means.

  3. #3
    Just Joined! pieman's Avatar
    Join Date
    Jan 2012
    Sunny Yorkshire
    Do you have something already listening on 443 rather than your app? Do you get any exceptions thrown, for example, when you try to listen.

    Another thing to check would be that you have the correct privileges. You usually need a high privilege to open a port under 1024.

    I think the :: means that you are listening on ipv6 rather than ipv4

  4. $spacer_open
  5. #4
    I disabled iptables and it worked. What do I need to do to get iptables to allow me to use the port? I've switched it back to port 2222. I have root access to the server. I've tried adding a rule for iptables, but I probably didn't do it right.

  6. #5

    With iptables disabled.

    This is what happens when I disable iptables (how it's suppose to work):

    [root@BattleTech BattleTech]# alias Battle='java -cp .:mysql-connector-java-5.1.16-bin.jar Main'
    [root@BattleTech BattleTech]# Battle
    Starting Battle Tech Server...
    Attempting to listen on port 2222
    User connected.
    Connecting user to database.
    Client:get version
    Client:user teynon
    MySQL: 1 matches.
    Server:User, ok.
    Clientass XXXXXX
    MySQL: 1 matches.
    Server:Pass, ok.

    Without disabling iptables, I get everything except User connected.
    Last edited by teynon; 01-25-2012 at 02:31 AM. Reason: Security... EEp

  7. #6
    Just Joined! pieman's Avatar
    Join Date
    Jan 2012
    Sunny Yorkshire

    It certainly looks like an iptables issue. I'm sorry, but I usually have that switched off as I work on a secure lan and I don't know much about iptables. Perhaps someone else can help?

Posting Permissions

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