Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8284505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:07:50+00:00 2026-06-08T11:07:50+00:00

I am creating a server built in Visual Basic 2010 and that program can

  • 0

I am creating a server built in Visual Basic 2010 and that program can insert/update/delete to a database that I use. I created a local Web Service that is used to synchronize the database on the server with the database in Android.

I use the following Android code :

package com.zelacroix.bukumenu;

import java.io.IOException;
import java.io.InputStream;

import org.apache.http.*;
import org.apache.http.client.*;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.params.*;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class Sinc extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sinc);
        Toast.makeText(getApplicationContext(), getKategori(), 5).show();
    }

    public String getKategori(){
        HttpParams httpParameters = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(httpParameters, 60000);
        HttpConnectionParams.setSoTimeout(httpParameters, 60000);
        HttpClient client=new DefaultHttpClient(httpParameters);
        HttpPost httpPost = new HttpPost("http://192.168.1.2:1924/TugasAkhir/Service.asmx/getKategori");
        HttpResponse response;
        String result="";
        try
        {
            response=client.execute(httpPost);
            HttpEntity entity= response.getEntity();
            DataHandler dataHandler = new DataHandler();
            if (entity!=null)
            {
                InputStream instream = entity.getContent();
                result = dataHandler.convertStreamToString(instream);
                instream.close();
            }
        } catch (ConnectTimeoutException e) {
                e.printStackTrace();
                Toast.makeText(getApplicationContext(), e.toString(), 100).show();
        } catch (IOException e) {
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), e.toString(), 100).show();
        }
        return result;
    }


}

I get an error :
org.apache.http.conn.httphostconnectexception connection to
``http://192.168.1.2:1924..... refused

For your information..
This code runs successfully when I’m using the emulator and change the IP address to 10.0.2.2.

This code also run successfully when I access a hosted online web service.
It fails only when I run the web service as local and try to access it with an Android device using my laptop’s IP (192.168.1.2).

I am using WIFI.

How can I fix this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:07:52+00:00Added an answer on June 8, 2026 at 11:07 am

    finally its solved.. the problem is visual studio 2010 so complicated in setting the IIS, then i try to developt my web service on Visual studio 2008 and IIS work fine! the Android can access the web service without connection refused.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Creating a server-side socket will fail if I'm trying to use the same port
I am creating a server chat program in java using DatagramSocket and datagramPacket im
I am using creating a server/client style program, and it uses tcp connections. Now,
I am creating a SQL Server database programmatically during a conversion. If the conversion
We have customers who, for unassailable reasons, cannot use SQL Server's built-in backup features
We're creating a desktop application which will use OLAP server to perform analysis. I'm
There is a medium size database application that needs to be built featuring a
I'm creating a server/client solution with custom user logins (not WindowsIdentity). I need a
The code below is creating a server to communicate with clients.This code works fine
I'm creating an game server list, and I want to measure uptime for certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.