2 Replies Latest reply on Mar 7, 2005 3:01 AM by 807596

    java.net.ConnectException: Connection refused

    807596
      I am trying to program a Web server for study. My file compiles and appears to work but I am getting refused the connection. I'm on an OS X box (unix/mac). I am using ports above 1024 and I have tried logging in as root. I still get this exception. The parameters passed are host port, or localhost 1055 or some other number above 1024. Can anybody help?

      -- thanks ahead of time

      here is the exception:
      java Connect localhost 1055
      java.net.ConnectException: Connection refused
      java.net.ConnectException: Connection refused
              at java.net.PlainSocketImpl.socketConnect(Native Method)
              at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
              at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
              at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
              at java.net.Socket.connect(Socket.java:452)
              at java.net.Socket.connect(Socket.java:402)
              at java.net.Socket.<init>(Socket.java:309)
              at java.net.Socket.<init>(Socket.java:124)
              at Connect.main(Connect.java:32)
        • 1. Re: java.net.ConnectException: Connection refused
          807596
          "connection refused" mean no server is listening on that port.
          Try
          telnet localhost 1055
          ad you should get the same thing.
          • 2. Re: java.net.ConnectException: Connection refused
            807596
            I am trying to program a Web server for study. My
            file compiles and appears to work but I am getting
            refused the connection. I'm on an OS X box
            (unix/mac). I am using ports above 1024 and I have
            tried logging in as root. I still get this
            exception. The parameters passed are host port, or
            localhost 1055 or some other number above 1024. Can
            anybody help?

            -- thanks ahead of time

            here is the exception:
            java Connect localhost 1055
            java.net.ConnectException: Connection refused
            java.net.ConnectException: Connection refused
            at
            at java.net.PlainSocketImpl.socketConnect(Native
            ative Method)
            at
            at
            at
            at
            java.net.PlainSocketImpl.doConnect(PlainSocketImpl.jav
            a:305)
            at
            at
            at
            at
            java.net.PlainSocketImpl.connectToAddress(PlainSocketI
            mpl.java:171)
            at
            at
            at
            at
            java.net.PlainSocketImpl.connect(PlainSocketImpl.java:
            158)
            at java.net.Socket.connect(Socket.java:452)
            at java.net.Socket.connect(Socket.java:402)
            at java.net.Socket.<init>(Socket.java:309)
            at java.net.Socket.<init>(Socket.java:124)
            at Connect.main(Connect.java:32)