Android ECONNREFUSED (Connection refused)

后端 未结 2 567
后悔当初
后悔当初 2020-12-11 22:26

I have tried to send data to server with this code from my android application.

try {
    HttpClient httpClient = new DefaultHttpClient();
    HttpPost httpP         


        
相关标签:
2条回答
  • 2020-12-11 22:35

    Adding to Christine's answer:

    I had a similar situation. I was trying to connect to another android device through it's hotspot. Even though they were connected in to the same network, I encountered this problem of "connect failed: ECONNREFUSED (Connection refused)".

    After spoiling a couple of days on this, I realized that my client device was connected to mobile Internet also.That means, my mobile data was ON.

    I turned it OFF and Viola !

    Make sure you are not connected to any other networks.

    Posted this in case it may help anybody.

    0 讨论(0)
  • 2020-12-11 22:45

    Is your phone on the same network as the computer where you connect with the ip number? Is the server on the public internet? I get this error when I forget to put my phone on my local wifi network and it wants to connect to a server on my local network.

    0 讨论(0)
提交回复
热议问题