Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble connecting a socket from android client app to server
    primarykey
    data
    text
    <p>I'm having trouble connecting a socket from my android phone to my computer running netcat listening on a port (5555). </p> <p>What I run in my android app:</p> <pre><code> try { Socket s = new Socket("My IP number here (not local IP)", 5555); DataOutputStream outToServer = new DataOutputStream(s.getOutputStream()); outToServer.writeBytes("Hello!"); s.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } </code></pre> <p>This is the line I use for netcat: <code>nc -l 5555</code></p> <p>I'm not sure what I'm missing.. I've forwarded the port on my router and rebooted the router. Added permission to internet in my android app. The phone is connected via 3G and my computer is connected via broadband. netcat is allowed in my firewall. </p> <p>I get a <code>SocketTimeoutException</code> error in my app when trying to connect. </p> <p>I guess the router takes care of handling which computer in the LAN will receive the request. </p> <p>Anyone know what I'm missing? </p> <p><strong>EDIT:</strong> I think I might have tracked down the problem.. I have two options on my router <code>Virtual Server</code> and <code>Port forwarding</code>. I don't know which to set to port 5555 in both UDP/TCP. <img src="https://i.stack.imgur.com/4RAur.png" alt="http://dl.dropbox.com/u/4385192/2011-11-19%2003.17.53%20pm.png"> <img src="https://i.stack.imgur.com/9MEgT.png" alt="enter image description here"> From what I understand it's <code>Virtual Server</code> I should use instead of the port forwarding? If so, could someone clarify the difference between the two? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload