Android Question Connection Refused

Discussion in 'Android Questions' started by Derek Jee, Jun 22, 2015.

  1. Derek Jee

    Derek Jee Active Member Licensed User

    Hello there

    I am trying to test a HTTP request on my pc but posting to the local host which is waiting as part of my VB (running in visual studio) web interface which should receive the request.. I get the error below. Can anyone tell me if it is actually possible to test like this? Many thanks,

    Derek.

    Error = org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:55763 refused
     
  2. Derek Jee

    Derek Jee Active Member Licensed User

    I have also used the pc ip address with no luck either.. This results in bad request and not connection refused..

    and used a different ip address and now get timeout.. I think this is the one I will concentrate on..
     
    Last edited: Jun 22, 2015
  3. Erel

    Erel Administrator Staff Member Licensed User

    Are you using an emulator? If yes then use this ip address to connect to the pc: 10.0.2.2
     
  4. Derek Jee

    Derek Jee Active Member Licensed User

    Hi Erel

    No, I'm using a device via wifi.. Might try that though and see if that works..

    Thank you..
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    127.0.0.1 points to the device. It will never connect to the pc.

    You can use the pc ip address, however Windows firewall blocks incoming connections. So you need to open the port for incoming connections.

    Because of the firewall issues it is simpler to let the device act as the server.
     
  6. Derek Jee

    Derek Jee Active Member Licensed User

    Hi Erel

    I have disabled my pc firewall still with no joy. I need to be able to debug the VB interface which receives the request from the device so need the pc to be the server. I have just set a vpn up on the device but still cannot see my pc. I saw there is a way to debug a site with visual studio so may upload the files to my actual server and see if that is a solution.. Thanks for your help..

    Derek.
     
  7. Derek Jee

    Derek Jee Active Member Licensed User

    Hi again..

    Still troubled with this issue.. More information for you to maybe assist further.

    I have created a Web API in Visual Studio.
    I have created an app on B4A and run it to my device to debug it (not emulator).
    I want to debug HTTP requests sent to my web API which is on my pc.
    I tried attaching to w3ww.exe in my VB API to catch any requests incoming.

    No luck..

    Any ideas what I can try to solve my problem? I have a log of debugging to do and would like to use my device and send requests to my API running on my pc..

    Thank you :)
     
  8. Erel

    Erel Administrator Staff Member Licensed User

  9. Derek Jee

    Derek Jee Active Member Licensed User

    Hi Erel

    No luck... I get a 'bad file number' when I press connect. (fcntl failed)

    I have IIS running on that IP and can see the IIS default page when I type it in my device browser..

    Thanks again..
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Do you get this error with the B4J example?
     
  11. Derek Jee

    Derek Jee Active Member Licensed User

    Sorry, I have not run the B4J example.. I am pretty sure it is my pc and permissions/IIS causing the issue. I am happy to continue right now and test the sending independently to the receiving, and merge the two later on..

    Thank you for your help on this, and sorry if I contact the forum again about this in the future..

    Derek.
     
Loading...