Address family not supported by protocol exception
<p>I'm trying to send a couple of values from an android application to a web service which I've setup. I'm using Http Post to send them but when I run the application I get the error- request time failed java.net.SocketException: Address family not supported by protocol.</p>

<p>I get this while debugging with both the emulator as well as a device connected by wifi. I've already added the internet permission using:</p>

<pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
</code></pre>

<p>This is the code i'm using to send the values</p>

<pre><code>    void insertData(String name, String number) throws Exception {
    String url = "http://192.168.0.12:8000/testapp/default/call/run/insertdbdata/";
    HttpClient client = new DefaultHttpClient();
    HttpPost post = new HttpPost(url);

    try {
        List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(2);

        params.add(new BasicNameValuePair("a", name));

        params.add(new BasicNameValuePair("b", number));
        post.setEntity(new UrlEncodedFormEntity(params));
        HttpResponse response = client.execute(post);
    }catch(Exception e){
        e.printStackTrace();
    }
</code></pre>

<p>Also I know that my web service work fine because when I send the values from an html page it works fine -</p>

<p>
</p>

<p></p>

<pre><code>&lt;form name="form1" action="http://192.168.0.12:8000/testapp/default/call/run/insertdbdata/" method="post"&gt;
    &lt;input type="text" name="a"/&gt;
    &lt;input type="text" name="b"/&gt;
    &lt;input type="submit"/&gt;
</code></pre>

<p>
</p>

<p>I've seen questions of similar problems but haven't really found a solution.</p>

<p>Thanks</p>
