Error 'null' in sockets connection , Android
<p><strong>What I was trying to do:</strong><br>
I was trying to build a test app, for now, simply establishing connection between the app on Android phone (4.2.2)(as client) and a java application running on pc (windows 8)(as server) via sockets connection.</p>

<p><strong>What I've done already:</strong><br>
I've made the programs for both client and server in java on pc and tested them positively (Connection got established).</p>

<p><strong>The network:</strong><br>
Both my phone and pc are connected to wifi at my home.<strong>ipconfig</strong> on pc shows address <strong>192.168.56.1</strong> while on logging into router it shows address of my pc to be <strong>192.168.0.108</strong> (Probably I don't understand networking :P).</p>

<p><strong>The code:</strong><br>
<strong>client(Android)</strong>  </p>

<pre><code>public void connectPC(View view)
{
    try
    {

        clientSocket = new Socket("192.168.0.108",1025);
        outstream = clientSocket.getOutputStream();
        instream = clientSocket.getInputStream();
        data_out = new DataOutputStream(outstream);
        data_in = new DataInputStream(instream);
        statusView.setText("Connected!");
    }
    catch (Exception e)
    {
        statusView.setText("Error: "+e.getMessage());
    }
}
</code></pre>

<p><strong>The Server:</strong></p>

<pre><code>import java.net.*;
import java.io.*;
public class ServerSide extends Thread
{
    ServerSocket serverSocket;
    public ServerSide(int port) throws IOException
    {
        serverSocket = new ServerSocket(1025);
        serverSocket.setSoTimeout(10000);
    }

    public void run()
    {
        while(true)
        {
            System.out.println("Waiting for client on port : "+ serverSocket.getLocalPort());
            Socket server;
            try {
                server = serverSocket.accept();
                System.out.println("Connected to : " +server.getRemoteSocketAddress());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                System.out.println(e.getMessage());
            }

        }
    }

    public static void main(String... args)
    {
        int port=6066;
        try
        {
            Thread t = new ServerSide(port);
            t.start();
        }
        catch(IOException e)
        {
            System.out.println(e.getMessage());
        }
    }
}
</code></pre>

<p><strong>The Problem:-</strong> The connection simply doesn't establish, the catch block shows <strong>e.getMessage()</strong> as null.</p>

<p><strong>PS</strong> I've tried <strong>192.168.56.1</strong> ip address too. And added <strong>uses permission</strong> in manifest file</p>

<p>Any help in this regard please..!</p>