title: Connection refused: connect, java socket
body: <p>I am new using java socket. I have a problem I can´t solve. 
  I have a server with a public IP, on it java server executes, then i have an android app client.
  With the socket i get to communicate from the client to the server, the problem comes when i try to do it the opposite way. 
  I tried sending a confirmation message from the server to the client. 
  It doesn´t matter how many time i try because i always end up having this error:</p>
  
  <p>java.net.ConnectException: Connection refused: connect</p>
  
  <pre><code>at java.net.DualStackPlainSocketImpl.connect0(Native Method)
  at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
  at java.net.Socket.connect(Socket.java:589)
  at java.net.Socket.connect(Socket.java:538)
  at java.net.Socket.&lt;init&gt;(Socket.java:434)
  at java.net.Socket.&lt;init&gt;(Socket.java:211)
  at server.ServerEntrada.run(ServerEntrada.java:48)
  at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>I have router port 9000 and 9001 open.</p>
  
  <p>The client sends through the port 9000 the data, and server recives them.
  Then the server sends them through port 9001 while the app is waiting through</p>