title: not able to get sockets programming to work on two android phones, port forewarding or some other cause?
body: <p>I used code from <a href="http://thinkandroid.wordpress.com/2010/03/27/incorporating-socket-programming-into-your-applications/" rel="nofollow"><strong>this</strong></a> website about socket programming in Android. One phone is the <code>client</code> while the other acts as <code>server</code>.  I copy/pasted the code exactly and placed the <code>server</code> code on one phone and that of <code>client</code> on the other. Both phones are connected <em>to the same wifi router</em>.</p>
  
  <p>However, I am unable to send even a simple message from the client to server phone.  I get <code>timeouts</code> and error of <code>java.net.ConnectException: failed to connect to /10.0.2.15 (port 8080): connect failed: EHOSTUNREACH (No route to host)</code></p>
  
  <p>I read that some others have succeeded using this code. That's why I suppose it has something to do with the wifi connection. I tried two other routers and faced the same problem. I also tried setting up <code>Port forwarding</code> (it is a setting on some routers that you tell the router that you are using some port like for example 8080 and you need to do this in order for the sockets programming to work). However, both routers don't have English language setting. So I couldn't find where the <code>port forwarding</code> setting is. I can get a new router with English language settings if it is required to get this thing working.  </p>
  
  <p>My question is: Do you think <code>port forewarding</code> setting may very likely be the problem or is there something else I have overlooked?  Any ideas to point me in the right direction would be appreciated. </p>
  
  <p>Here is the full Logcat output:</p>
  
  <pre><code>01-22 18:37:40.100: E/ClientActivity(19568): C: Error
  01-22 18:37:40.100: E/ClientActivity(19568): java.net.ConnectException: failed to connect to /10.0.2.15 (port 8080): connect failed: EHOSTUNREACH (No route to host)
  01-22 18:37:40.100: E/ClientActivity(19568):    at libcore.io.IoBridge.connect(IoBridge.java:114)
  01-22 18:37:40.100: E/ClientActivity(19568):    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
  01-22 18:37:40.100: E/ClientActivity(19568):    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
  01-22 18:37:40.100: E/ClientActivity(19568):    at java.net.Socket.startupSocket(Socket.java:566)
  01-22 18:37:40.100: E/ClientActivity(19568):    at java.net.Socket.&lt;init&gt;(Socket.java:225)
  01-22 18:37:40.100: E/ClientActivity(19568):    at com.example.client.ClientActivity$ClientThread.run(ClientActivity.java:60)
  01-22 18:37:40.100: E/ClientActivity(19568):    at java.lang.Thread.run(Thread.java:856)
  01-22 18:37:40.100: E/ClientActivity(19568): Caused by: libcore.io.ErrnoException: connect failed: EHOSTUNREACH (No route to host)
  01-22 18:37:40.100: E/ClientActivity(19568):    at libcore.io.Posix.connect(Native Method)
  01-22 18:37:40.100: E/ClientActivity(19568):    at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
  01-22 18:37:40.100: E/ClientActivity(19568):    at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
  01-22 18:37:40.100: E/ClientActivity(19568):    at libcore.io.IoBridge.connect(IoBridge.java:112)
  </code></pre>